Class UnsyncStack<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
org.languagetool.rules.UnsyncStack<E>
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess, SequencedCollection<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longGenerated automatically.Fields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanempty()Tests if this stack is empty.peek()Looks at the object at the top of this stack without removing it from the stack.pop()Removes the object at the top of this stack and returns that object as the value of this function.Pushes an item onto the top of this stack.intReturns the 1-based position where an object is on this stack.Methods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDGenerated automatically.- See Also:
-
-
Constructor Details
-
UnsyncStack
UnsyncStack()
-
-
Method Details
-
push
-
pop
Removes the object at the top of this stack and returns that object as the value of this function.- Returns:
- The object at the top of this stack (the last item of the ArrayList object).
- Throws:
EmptyStackException- if this stack is empty.
-
peek
Looks at the object at the top of this stack without removing it from the stack.- Returns:
- the object at the top of this stack (the last item of the ArrayList object).
- Throws:
EmptyStackException- if this stack is empty.
-
empty
public boolean empty()Tests if this stack is empty.- Returns:
trueif and only if this stack contains no items;falseotherwise.
-
search
Returns the 1-based position where an object is on this stack. If the object o occurs as an item in this stack, this method returns the distance from the top of the stack of the occurrence nearest the top of the stack; the topmost item on the stack is considered to be at distance 1. The equals method is used to compare o to the items in this stack.- Parameters:
o- the desired object.- Returns:
- the 1-based position from the top of the stack where the object is
located; the return value
-1indicates that the object is not on the stack.
-