diff options
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java deleted file mode 100644 index bf9c34c88e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.EmptyStackException; - -/** - * Interface defining the classic stack behavior, - * without the backdoors allowed by {@link java.util.Stack}. - * - * @param <E> the type of elements contained by the stack - */ -public interface Stack<E> { - - /** - * "Push" the specified item on to the top of the stack. - */ - void push(E element); - - /** - * "Pop" an item from the top of the stack. - */ - E pop(); - - /** - * Return the item on the top of the stack - * without removing it from the stack. - */ - E peek(); - - /** - * Return whether the stack is empty. - */ - boolean isEmpty(); - - - final class Empty<E> - implements Stack<E>, Serializable - { - @SuppressWarnings("rawtypes") - public static final Stack INSTANCE = new Empty(); - @SuppressWarnings("unchecked") - public static <T> Stack<T> instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - public void push(E element) { - throw new UnsupportedOperationException(); - } - public E pop() { - throw new EmptyStackException(); - } - public E peek() { - throw new EmptyStackException(); - } - public boolean isEmpty() { - return true; - } - @Override - public String toString() { - return StringTools.buildSingletonToString(this); - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } -} |