|
|||||||||
Home >> All >> javax >> ide >> extension >> [ spi overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
javax.ide.extension.spi
Class Stack

java.lang.Objectjava.util.AbstractCollection
javax.ide.extension.spi.Stack
- All Implemented Interfaces:
- java.util.Collection, java.lang.Iterable
- public final class Stack
- extends java.util.AbstractCollection
Convenient implementation of a Last In First Out (LIFO) stack. This implementation differs from the one in java.util.Stack in two ways. First, like most of the collection APIs, it is unsynchronized for better performance when synchronization is not required. If a synchronized stack is required, you can use the Collections.synchronizedCollection() 55 method to retrieve a synchronized instance. Second, it does not expose its internal implementation via its superclass. Extending AbstractCollection instead of Vector allows objects of this class to be used interchangably with other collection framework classes without exposing its internal implementation.
Nested Class Summary | |
private static class |
Stack.ReverseListIterator
Iterator that traverses a list in reverse order. |
Field Summary | |
private java.util.ArrayList |
_list
|
Constructor Summary | |
Stack()
Construct a stack with no additional arguments. |
|
Stack(java.util.Collection c)
Construct a stack initialized to contain all the items in the specified collection. |
Method Summary | |
boolean |
add(java.lang.Object o)
Add an object to the collection (optional operation). |
void |
clear()
Remove all elements from the collection (optional operation). |
private java.util.List |
getList()
Gets (or lazily instantiates) the list implementation used by this stack. |
boolean |
isEmpty()
Gets whether there are more elements on the stack. |
java.util.Iterator |
iterator()
Gets an iterator for elements on the stack. |
java.lang.Object |
peek()
Obtains the top element on the stack without removing it. |
java.lang.Object |
pop()
Pops the top element off the stack and returns it. |
boolean |
push(java.lang.Object o)
Pushes an element onto the stack. |
void |
replace(java.lang.Object o)
Replaces the top of the stack with the specified object. |
java.util.Iterator |
reverseIterator()
Gets an iterator for elements on the stack. |
int |
size()
Return the number of elements in this collection. |
Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
equals, hashCode |
Field Detail |
_list
private java.util.ArrayList _list
Constructor Detail |
Stack
public Stack()
- Construct a stack with no additional arguments.
Stack
public Stack(java.util.Collection c)
- Construct a stack initialized to contain all the items in the specified
collection. The items will be pushed on to the stack in their order in
the collection.
Method Detail |
getList
private java.util.List getList()
- Gets (or lazily instantiates) the list implementation used by this stack.
isEmpty
public boolean isEmpty()
- Gets whether there are more elements on the stack.
push
public boolean push(java.lang.Object o)
- Pushes an element onto the stack.
peek
public java.lang.Object peek()
- Obtains the top element on the stack without removing it.
replace
public void replace(java.lang.Object o)
- Replaces the top of the stack with the specified object.
pop
public java.lang.Object pop()
- Pops the top element off the stack and returns it.
reverseIterator
public java.util.Iterator reverseIterator()
- Gets an iterator for elements on the stack. This iterator starts at the
bottom of the stack and proceeds to the top.
add
public boolean add(java.lang.Object o)
- Description copied from class:
java.util.AbstractCollection
- Add an object to the collection (optional operation). This implementation
always throws an UnsupportedOperationException - it should be
overridden if the collection is to be modifiable. If the collection
does not accept duplicates, simply return false. Collections may specify
limitations on what may be added.
clear
public void clear()
- Description copied from class:
java.util.AbstractCollection
- Remove all elements from the collection (optional operation). This
implementation obtains an iterator over the collection and calls next
and remove on it repeatedly (thus this method will fail with an
UnsupportedOperationException if the Iterator's remove method does)
until there are no more elements to remove.
Many implementations will have a faster way of doing this.
iterator
public java.util.Iterator iterator()
- Gets an iterator for elements on the stack. The iterator starts at the
top of the stack and proceeds to the bottom of the stack.
size
public int size()
- Description copied from class:
java.util.AbstractCollection
- Return the number of elements in this collection. If there are more than
Integer.MAX_VALUE elements, return Integer.MAX_VALUE.
|
|||||||||
Home >> All >> javax >> ide >> extension >> [ spi overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |