Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Fields](https://developer.android.com/reference/java/util/Stack#inhfields) \| [Ctors](https://developer.android.com/reference/java/util/Stack#pubctors) \| [Methods](https://developer.android.com/reference/java/util/Stack#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/Stack#inhmethods)

# Stack

` public class Stack `   
` ` ` ` ` ` ` extends https://developer.android.com/reference/java/util/Vector<E> ` ` `

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||||
| ↳ | [java.util.AbstractCollection](https://developer.android.com/reference/java/util/AbstractCollection)\<E\> ||||
|   | ↳ | [java.util.AbstractList](https://developer.android.com/reference/java/util/AbstractList)\<E\> |||
|   |   | ↳ | [java.util.Vector](https://developer.android.com/reference/java/util/Vector)\<E\> ||
|   |   |   | ↳ | java.util.Stack\<E\> |

<br />

*** ** * ** ***

The `Stack` class represents a last-in-first-out (LIFO) stack of objects. It extends class `Vector` with five operations that allow a vector to be treated as a stack. The usual `push` and `pop` operations are provided, as well as a method to `peek` at the top item on the stack, a method to test for whether the stack is `empty`, and a method to `search` the stack for an item and discover how far it is from the top.

When a stack is first created, it contains no items.

A more complete and consistent set of LIFO stack operations is provided by the `https://developer.android.com/reference/java/util/Deque` interface and its implementations, which should be used in preference to this class. For example:

    Deque<Integer> stack = new ArrayDeque<Integer>();

<br />

## Summary

### Inherited fields

From class `https://developer.android.com/reference/java/util/Vector` ` protected int` `https://developer.android.com/reference/java/util/Vector#capacityIncrement`

The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.
` protected int` `https://developer.android.com/reference/java/util/Vector#elementCount`

The number of valid components in this `Vector` object.
` protected https://developer.android.com/reference/java/lang/Object` `https://developer.android.com/reference/java/util/Vector#elementData`

The array buffer into which the components of the vector are stored.
From class `https://developer.android.com/reference/java/util/AbstractList` ` protected int` `https://developer.android.com/reference/java/util/AbstractList#modCount`

The number of times this list has been *structurally modified*.

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/Stack#Stack()() ` Creates an empty Stack. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/util/Stack#empty()() ` Tests if this stack is empty. |
| ` E` | ` https://developer.android.com/reference/java/util/Stack#peek()() ` Looks at the object at the top of this stack without removing it from the stack. |
| ` E` | ` https://developer.android.com/reference/java/util/Stack#pop()() ` Removes the object at the top of this stack and returns that object as the value of this function. |
| ` E` | ` https://developer.android.com/reference/java/util/Stack#push(E)(E item) ` Pushes an item onto the top of this stack. |
| ` int` | ` https://developer.android.com/reference/java/util/Stack#search(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Returns the 1-based position where an object is on this stack. |

### Inherited methods

From class ` https://developer.android.com/reference/java/util/Vector ` ` void` ` https://developer.android.com/reference/java/util/Vector#add(int,%20E)(int index, E element) `

Inserts the specified element at the specified position in this Vector.
` boolean` ` https://developer.android.com/reference/java/util/Vector#add(E)(E e) `

Appends the specified element to the end of this Vector.
` boolean` ` https://developer.android.com/reference/java/util/Vector#addAll(int,%20java.util.Collection<?%20extends%20E>)(int index, https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Inserts all of the elements in the specified Collection into this Vector at the specified position.
` boolean` ` https://developer.android.com/reference/java/util/Vector#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.
` void` ` https://developer.android.com/reference/java/util/Vector#addElement(E)(E obj) `

Adds the specified component to the end of this vector, increasing its size by one.
` int` ` https://developer.android.com/reference/java/util/Vector#capacity()() `

Returns the current capacity of this vector.
` void` ` https://developer.android.com/reference/java/util/Vector#clear()() `

Removes all of the elements from this Vector.
` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/util/Vector#clone()() `

Returns a clone of this vector.
` boolean` ` https://developer.android.com/reference/java/util/Vector#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns `true` if this vector contains the specified element.
` boolean` ` https://developer.android.com/reference/java/util/Vector#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Returns true if this Vector contains all of the elements in the specified Collection.
` void` ` https://developer.android.com/reference/java/util/Vector#copyInto(java.lang.Object[])(https://developer.android.com/reference/java/lang/Object anArray) `

Copies the components of this vector into the specified array.
` E` ` https://developer.android.com/reference/java/util/Vector#elementAt(int)(int index) `

Returns the component at the specified index.
` https://developer.android.com/reference/java/util/Enumeration<E>` ` https://developer.android.com/reference/java/util/Vector#elements()() `

Returns an enumeration of the components of this vector.
` void` ` https://developer.android.com/reference/java/util/Vector#ensureCapacity(int)(int minCapacity) `

Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
` boolean` ` https://developer.android.com/reference/java/util/Vector#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Compares the specified Object with this Vector for equality.
` E` ` https://developer.android.com/reference/java/util/Vector#firstElement()() `

Returns the first component (the item at index `0`) of this vector.
` void` ` https://developer.android.com/reference/java/util/Vector#forEach(java.util.function.Consumer<?%20super%20E>)(https://developer.android.com/reference/java/util/function/Consumer<? super E> action) ` ` E` ` https://developer.android.com/reference/java/util/Vector#get(int)(int index) `

Returns the element at the specified position in this Vector.
` int` ` https://developer.android.com/reference/java/util/Vector#hashCode()() `

Returns the hash code value for this Vector.
` int` ` https://developer.android.com/reference/java/util/Vector#indexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the first occurrence of the specified element in this vector, or -1 if this vector does not contain the element.
` int` ` https://developer.android.com/reference/java/util/Vector#indexOf(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object o, int index) `

Returns the index of the first occurrence of the specified element in this vector, searching forwards from `index`, or returns -1 if the element is not found.
` void` ` https://developer.android.com/reference/java/util/Vector#insertElementAt(E,%20int)(E obj, int index) `

Inserts the specified object as a component in this vector at the specified `index`.
` boolean` ` https://developer.android.com/reference/java/util/Vector#isEmpty()() `

Tests if this vector has no components.
` https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/util/Vector#iterator()() `

Returns an iterator over the elements in this list in proper sequence.
` E` ` https://developer.android.com/reference/java/util/Vector#lastElement()() `

Returns the last component of the vector.
` int` ` https://developer.android.com/reference/java/util/Vector#lastIndexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the last occurrence of the specified element in this vector, or -1 if this vector does not contain the element.
` int` ` https://developer.android.com/reference/java/util/Vector#lastIndexOf(java.lang.Object,%20int)(https://developer.android.com/reference/java/lang/Object o, int index) `

Returns the index of the last occurrence of the specified element in this vector, searching backwards from `index`, or returns -1 if the element is not found.
` https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/Vector#listIterator(int)(int index) `

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
` https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/Vector#listIterator()() `

Returns a list iterator over the elements in this list (in proper sequence).
` boolean` ` https://developer.android.com/reference/java/util/Vector#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.
` E` ` https://developer.android.com/reference/java/util/Vector#remove(int)(int index) `

Removes the element at the specified position in this Vector.
` boolean` ` https://developer.android.com/reference/java/util/Vector#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Removes from this Vector all of its elements that are contained in the specified Collection.
` void` ` https://developer.android.com/reference/java/util/Vector#removeAllElements()() `

Removes all components from this vector and sets its size to zero.
` boolean` ` https://developer.android.com/reference/java/util/Vector#removeElement(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Removes the first (lowest-indexed) occurrence of the argument from this vector.
` void` ` https://developer.android.com/reference/java/util/Vector#removeElementAt(int)(int index) `

Deletes the component at the specified index.
` boolean` ` https://developer.android.com/reference/java/util/Vector#removeIf(java.util.function.Predicate<?%20super%20E>)(https://developer.android.com/reference/java/util/function/Predicate<? super E> filter) `

Removes all of the elements of this collection that satisfy the given predicate (optional operation).
` void` ` https://developer.android.com/reference/java/util/Vector#removeRange(int,%20int)(int fromIndex, int toIndex) `

Removes from this list all of the elements whose index is between `fromIndex`, inclusive, and `toIndex`, exclusive.
` void` ` https://developer.android.com/reference/java/util/Vector#replaceAll(java.util.function.UnaryOperator<E>)(https://developer.android.com/reference/java/util/function/UnaryOperator<E> operator) `

Replaces each element of this list with the result of applying the operator to that element (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/Vector#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Retains only the elements in this Vector that are contained in the specified Collection.
` E` ` https://developer.android.com/reference/java/util/Vector#set(int,%20E)(int index, E element) `

Replaces the element at the specified position in this Vector with the specified element.
` void` ` https://developer.android.com/reference/java/util/Vector#setElementAt(E,%20int)(E obj, int index) `

Sets the component at the specified `index` of this vector to be the specified object.
` void` ` https://developer.android.com/reference/java/util/Vector#setSize(int)(int newSize) `

Sets the size of this vector.
` int` ` https://developer.android.com/reference/java/util/Vector#size()() `

Returns the number of components in this vector.
` void` ` https://developer.android.com/reference/java/util/Vector#sort(java.util.Comparator<?%20super%20E>)(https://developer.android.com/reference/java/util/Comparator<? super E> c) `

Sorts this list according to the order induced by the specified `https://developer.android.com/reference/java/util/Comparator` (optional operation).
` https://developer.android.com/reference/java/util/Spliterator<E>` ` https://developer.android.com/reference/java/util/Vector#spliterator()() `

Creates a *[late-binding](https://developer.android.com/reference/java/util/Spliterator#binding)* and *fail-fast* `https://developer.android.com/reference/java/util/Spliterator` over the elements in this list.
` https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/Vector#subList(int,%20int)(int fromIndex, int toIndex) `

Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive.
` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/util/Vector#toArray()() `

Returns an array containing all of the elements in this Vector in the correct order.
` <T> T[]` ` https://developer.android.com/reference/java/util/Vector#toArray(T[])(T[] a) `

Returns an array containing all of the elements in this Vector in the correct order; the runtime type of the returned array is that of the specified array.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/util/Vector#toString()() `

Returns a string representation of this Vector, containing the String representation of each element.
` void` ` https://developer.android.com/reference/java/util/Vector#trimToSize()() `

Trims the capacity of this vector to be the vector's current size.
From class ` https://developer.android.com/reference/java/util/AbstractList ` ` void` ` https://developer.android.com/reference/java/util/AbstractList#add(int,%20E)(int index, E element) `

Inserts the specified element at the specified position in this list (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractList#add(E)(E e) `

Appends the specified element to the end of this list (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractList#addAll(int,%20java.util.Collection<?%20extends%20E>)(int index, https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
` void` ` https://developer.android.com/reference/java/util/AbstractList#clear()() `

Removes all of the elements from this list (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractList#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Compares the specified object with this list for equality.
` abstract E` ` https://developer.android.com/reference/java/util/AbstractList#get(int)(int index) `

Returns the element at the specified position in this list.
` int` ` https://developer.android.com/reference/java/util/AbstractList#hashCode()() `

Returns the hash code value for this list.
` int` ` https://developer.android.com/reference/java/util/AbstractList#indexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
` https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/util/AbstractList#iterator()() `

Returns an iterator over the elements in this list in proper sequence.
` int` ` https://developer.android.com/reference/java/util/AbstractList#lastIndexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
` https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/AbstractList#listIterator(int)(int index) `

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
` https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/AbstractList#listIterator()() `

Returns a list iterator over the elements in this list (in proper sequence).
` E` ` https://developer.android.com/reference/java/util/AbstractList#remove(int)(int index) `

Removes the element at the specified position in this list (optional operation).
` void` ` https://developer.android.com/reference/java/util/AbstractList#removeRange(int,%20int)(int fromIndex, int toIndex) `

Removes from this list all of the elements whose index is between `fromIndex`, inclusive, and `toIndex`, exclusive.
` E` ` https://developer.android.com/reference/java/util/AbstractList#set(int,%20E)(int index, E element) `

Replaces the element at the specified position in this list with the specified element (optional operation).
` https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/AbstractList#subList(int,%20int)(int fromIndex, int toIndex) `

Returns a view of the portion of this list between the specified `fromIndex`, inclusive, and `toIndex`, exclusive.
From class ` https://developer.android.com/reference/java/util/AbstractCollection ` ` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#add(E)(E e) `

Ensures that this collection contains the specified element (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Adds all of the elements in the specified collection to this collection (optional operation).
` void` ` https://developer.android.com/reference/java/util/AbstractCollection#clear()() `

Removes all of the elements from this collection (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns `true` if this collection contains the specified element.
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Returns `true` if this collection contains all of the elements in the specified collection.
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#isEmpty()() `

Returns `true` if this collection contains no elements.
` abstract https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/util/AbstractCollection#iterator()() `

Returns an iterator over the elements contained in this collection.
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Removes a single instance of the specified element from this collection, if it is present (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Removes all of this collection's elements that are also contained in the specified collection (optional operation).
` boolean` ` https://developer.android.com/reference/java/util/AbstractCollection#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Retains only the elements in this collection that are contained in the specified collection (optional operation).
` abstract int` ` https://developer.android.com/reference/java/util/AbstractCollection#size()() `

Returns the number of elements in this collection.
` <T> T[]` ` https://developer.android.com/reference/java/util/AbstractCollection#toArray(T[])(T[] a) `

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/util/AbstractCollection#toArray()() `

Returns an array containing all of the elements in this collection.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/util/AbstractCollection#toString()() `

Returns a string representation of this collection.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/util/List ` ` abstract boolean` ` https://developer.android.com/reference/java/util/List#add(E)(E e) `

Appends the specified element to the end of this list (optional operation).
` abstract void` ` https://developer.android.com/reference/java/util/List#add(int,%20E)(int index, E element) `

Inserts the specified element at the specified position in this list (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#addAll(int,%20java.util.Collection<?%20extends%20E>)(int index, https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
` default void` ` https://developer.android.com/reference/java/util/List#addFirst(E)(E e) `

Adds an element as the first element of this collection (optional operation).
` default void` ` https://developer.android.com/reference/java/util/List#addLast(E)(E e) `

Adds an element as the last element of this collection (optional operation).
` abstract void` ` https://developer.android.com/reference/java/util/List#clear()() `

Removes all of the elements from this list (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns `true` if this list contains the specified element.
` abstract boolean` ` https://developer.android.com/reference/java/util/List#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Returns `true` if this list contains all of the elements of the specified collection.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#copyOf(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> coll) `

Returns an [unmodifiable List](https://developer.android.com/reference/java/util/Stack#unmodifiable) containing the elements of the given Collection, in its iteration order.
` abstract boolean` ` https://developer.android.com/reference/java/util/List#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Compares the specified object with this list for equality.
` abstract E` ` https://developer.android.com/reference/java/util/List#get(int)(int index) `

Returns the element at the specified position in this list.
` default E` ` https://developer.android.com/reference/java/util/List#getFirst()() `

Gets the first element of this collection.
` default E` ` https://developer.android.com/reference/java/util/List#getLast()() `

Gets the last element of this collection.
` abstract int` ` https://developer.android.com/reference/java/util/List#hashCode()() `

Returns the hash code value for this list.
` abstract int` ` https://developer.android.com/reference/java/util/List#indexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
` abstract boolean` ` https://developer.android.com/reference/java/util/List#isEmpty()() `

Returns `true` if this list contains no elements.
` abstract https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/util/List#iterator()() `

Returns an iterator over the elements in this list in proper sequence.
` abstract int` ` https://developer.android.com/reference/java/util/List#lastIndexOf(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
` abstract https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/List#listIterator(int)(int index) `

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
` abstract https://developer.android.com/reference/java/util/ListIterator<E>` ` https://developer.android.com/reference/java/util/List#listIterator()() `

Returns a list iterator over the elements in this list (in proper sequence).
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E)(E e1, E e2, E e3) `

Returns an unmodifiable list containing three elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) `

Returns an unmodifiable list containing nine elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5) `

Returns an unmodifiable list containing five elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6) `

Returns an unmodifiable list containing six elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) `

Returns an unmodifiable list containing eight elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E[])(E... elements) `

Returns an unmodifiable list containing an arbitrary number of elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of()() `

Returns an unmodifiable list containing zero elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) `

Returns an unmodifiable list containing ten elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E)(E e1, E e2) `

Returns an unmodifiable list containing two elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6, E e7) `

Returns an unmodifiable list containing seven elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4) `

Returns an unmodifiable list containing four elements.
` static <E> https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#of(E)(E e1) `

Returns an unmodifiable list containing one element.
` abstract E` ` https://developer.android.com/reference/java/util/List#remove(int)(int index) `

Removes the element at the specified position in this list (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Removes the first occurrence of the specified element from this list, if it is present (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Removes from this list all of its elements that are contained in the specified collection (optional operation).
` default E` ` https://developer.android.com/reference/java/util/List#removeFirst()() `

Removes and returns the first element of this collection (optional operation).
` default E` ` https://developer.android.com/reference/java/util/List#removeLast()() `

Removes and returns the last element of this collection (optional operation).
` default void` ` https://developer.android.com/reference/java/util/List#replaceAll(java.util.function.UnaryOperator<E>)(https://developer.android.com/reference/java/util/function/UnaryOperator<E> operator) `

Replaces each element of this list with the result of applying the operator to that element (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/List#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Retains only the elements in this list that are contained in the specified collection (optional operation).
` default https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#reversed()() `

Returns a reverse-ordered [view](https://developer.android.com/reference/java/util/Collection#view) of this collection.
` abstract E` ` https://developer.android.com/reference/java/util/List#set(int,%20E)(int index, E element) `

Replaces the element at the specified position in this list with the specified element (optional operation).
` abstract int` ` https://developer.android.com/reference/java/util/List#size()() `

Returns the number of elements in this list.
` default void` ` https://developer.android.com/reference/java/util/List#sort(java.util.Comparator<?%20super%20E>)(https://developer.android.com/reference/java/util/Comparator<? super E> c) `

Sorts this list according to the order induced by the specified `https://developer.android.com/reference/java/util/Comparator` (optional operation).
` default https://developer.android.com/reference/java/util/Spliterator<E>` ` https://developer.android.com/reference/java/util/List#spliterator()() `

Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements in this list.
` abstract https://developer.android.com/reference/java/util/List<E>` ` https://developer.android.com/reference/java/util/List#subList(int,%20int)(int fromIndex, int toIndex) `

Returns a view of the portion of this list between the specified `fromIndex`, inclusive, and `toIndex`, exclusive.
` abstract https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/util/List#toArray()() `

Returns an array containing all of the elements in this list in proper sequence (from first to last element).
` abstract <T> T[]` ` https://developer.android.com/reference/java/util/List#toArray(T[])(T[] a) `

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
From interface ` https://developer.android.com/reference/java/util/Collection ` ` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#add(E)(E e) `

Ensures that this collection contains the specified element (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) `

Adds all of the elements in the specified collection to this collection (optional operation).
` abstract void` ` https://developer.android.com/reference/java/util/Collection#clear()() `

Removes all of the elements from this collection (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Returns `true` if this collection contains the specified element.
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Returns `true` if this collection contains all of the elements in the specified collection.
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Compares the specified object with this collection for equality.
` abstract int` ` https://developer.android.com/reference/java/util/Collection#hashCode()() `

Returns the hash code value for this collection.
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#isEmpty()() `

Returns `true` if this collection contains no elements.
` abstract https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/util/Collection#iterator()() `

Returns an iterator over the elements in this collection.
` default https://developer.android.com/reference/java/util/stream/Stream<E>` ` https://developer.android.com/reference/java/util/Collection#parallelStream()() `

Returns a possibly parallel `Stream` with this collection as its source.
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

Removes a single instance of the specified element from this collection, if it is present (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Removes all of this collection's elements that are also contained in the specified collection (optional operation).
` default boolean` ` https://developer.android.com/reference/java/util/Collection#removeIf(java.util.function.Predicate<?%20super%20E>)(https://developer.android.com/reference/java/util/function/Predicate<? super E> filter) `

Removes all of the elements of this collection that satisfy the given predicate (optional operation).
` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) `

Retains only the elements in this collection that are contained in the specified collection (optional operation).
` abstract int` ` https://developer.android.com/reference/java/util/Collection#size()() `

Returns the number of elements in this collection.
` default https://developer.android.com/reference/java/util/Spliterator<E>` ` https://developer.android.com/reference/java/util/Collection#spliterator()() `

Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements in this collection.
` default https://developer.android.com/reference/java/util/stream/Stream<E>` ` https://developer.android.com/reference/java/util/Collection#stream()() `

Returns a sequential `Stream` with this collection as its source.
` abstract <T> T[]` ` https://developer.android.com/reference/java/util/Collection#toArray(T[])(T[] a) `

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
` abstract https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/util/Collection#toArray()() `

Returns an array containing all of the elements in this collection.
` default <T> T[]` ` https://developer.android.com/reference/java/util/Collection#toArray(java.util.function.IntFunction<T[]>)(https://developer.android.com/reference/java/util/function/IntFunction<T[]> generator) `

Returns an array containing all of the elements in this collection, using the provided `generator` function to allocate the returned array.
From interface ` https://developer.android.com/reference/java/util/SequencedCollection ` ` default void` ` https://developer.android.com/reference/java/util/SequencedCollection#addFirst(E)(E e) `

Adds an element as the first element of this collection (optional operation).
` default void` ` https://developer.android.com/reference/java/util/SequencedCollection#addLast(E)(E e) `

Adds an element as the last element of this collection (optional operation).
` default E` ` https://developer.android.com/reference/java/util/SequencedCollection#getFirst()() `

Gets the first element of this collection.
` default E` ` https://developer.android.com/reference/java/util/SequencedCollection#getLast()() `

Gets the last element of this collection.
` default E` ` https://developer.android.com/reference/java/util/SequencedCollection#removeFirst()() `

Removes and returns the first element of this collection (optional operation).
` default E` ` https://developer.android.com/reference/java/util/SequencedCollection#removeLast()() `

Removes and returns the last element of this collection (optional operation).
` abstract https://developer.android.com/reference/java/util/SequencedCollection<E>` ` https://developer.android.com/reference/java/util/SequencedCollection#reversed()() `

Returns a reverse-ordered [view](https://developer.android.com/reference/java/util/Collection#view) of this collection.
From interface ` https://developer.android.com/reference/java/lang/Iterable ` ` default void` ` https://developer.android.com/reference/java/lang/Iterable#forEach(java.util.function.Consumer<?%20super%20T>)(https://developer.android.com/reference/java/util/function/Consumer<? super T> action) `

Performs the given action for each element of the `Iterable` until all elements have been processed or the action throws an exception.
` abstract https://developer.android.com/reference/java/util/Iterator<E>` ` https://developer.android.com/reference/java/lang/Iterable#iterator()() `

Returns an iterator over elements of type `T`.
` default https://developer.android.com/reference/java/util/Spliterator<E>` ` https://developer.android.com/reference/java/lang/Iterable#spliterator()() `

Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements described by this `Iterable`.

## Public constructors

### Stack

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Stack ()
```

Creates an empty Stack.

<br />

## Public methods

### empty

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean empty ()
```

Tests if this stack is empty.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if and only if this stack contains no items; `false` otherwise. <br /> |

### peek

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public E peek ()
```

Looks at the object at the top of this stack without removing it from the stack.

<br />

| Returns ||
|---|---|
| `E` | the object at the top of this stack (the last item of the `Vector` object). <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/util/EmptyStackException` | if this stack is empty. |

### pop

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public E pop ()
```

Removes the object at the top of this stack and returns that object as the value of this function.

<br />

| Returns ||
|---|---|
| `E` | The object at the top of this stack (the last item of the `Vector` object). <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/util/EmptyStackException` | if this stack is empty. |

### push

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public E push (E item)
```

Pushes an item onto the top of this stack. This has exactly the same effect as:
>
> ```
> addElement(item)
> ```

<br />

<br />

| Parameters ||
|---|---|
| `item` | `E`: the item to be pushed onto this stack. <br /> |

| Returns ||
|---|---|
| `E` | the `item` argument. <br /> |

**See also:**

- `https://developer.android.com/reference/java/util/Vector#addElement(E)`

### search

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int search (Object o)
```

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.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the desired object. <br /> |

| Returns ||
|---|---|
| `int` | the 1-based position from the top of the stack where the object is located; the return value `-1` indicates that the object is not on the stack. <br /> |