Stack Class

Definition

The Stack class represents a last-in-first-out (LIFO) stack of objects.

[Android.Runtime.Register("java/util/Stack", DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "E" })]
public class Stack : Java.Util.Vector
[<Android.Runtime.Register("java/util/Stack", DoNotGenerateAcw=true)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E" })>]
type Stack = class
    inherit Vector
Inheritance
Attributes

Remarks

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 Deque interface and its implementations, which should be used in preference to this class. For example:

{@code
              Deque<Integer> stack = new ArrayDeque<Integer>();}

Added in 1.0.

Java documentation for java.util.Stack.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Stack()

Creates an empty Stack.

Stack(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

CapacityIncrement

The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.

(Inherited from Vector)
Class

Returns the runtime class of this Object.

(Inherited from Object)
ElementCount

The number of valid components in this Vector object.

(Inherited from Vector)
ElementData

The array buffer into which the components of the vector are stored.

(Inherited from Vector)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsEmpty

To be added

(Inherited from AbstractCollection)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
ModCount

The number of times this list has been structurally modified.

(Inherited from AbstractList)
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Add(Int32, Object)

To be added

(Inherited from AbstractList)
Add(Object)

To be added

(Inherited from AbstractCollection)
AddAll(ICollection)

To be added

(Inherited from AbstractCollection)
AddAll(Int32, ICollection)

To be added

(Inherited from AbstractList)
AddElement(Object)

Adds the specified component to the end of this vector, increasing its size by one.

(Inherited from Vector)
Capacity()

Returns the current capacity of this vector.

(Inherited from Vector)
Clear()

To be added

(Inherited from AbstractCollection)
Clone()

Returns a clone of this vector.

(Inherited from Vector)
Contains(Object)

To be added

(Inherited from AbstractCollection)
ContainsAll(ICollection)

To be added

(Inherited from AbstractCollection)
CopyInto(Object[])

Copies the components of this vector into the specified array.

(Inherited from Vector)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
ElementAt(Int32)

Returns the component at the specified index.

(Inherited from Vector)
Elements()

Returns an enumeration of the components of this vector.

(Inherited from Vector)
Empty()

Tests if this stack is empty.

EnsureCapacity(Int32)

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.

(Inherited from Vector)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FirstElement()

Returns the first component (the item at index 0) of this vector.

(Inherited from Vector)
ForEach(IConsumer) (Inherited from Vector)
Get(Int32)

Returns the element at the specified position in this Vector.

(Inherited from Vector)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IndexOf(Object)

To be added

(Inherited from AbstractList)
IndexOf(Object, Int32)

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.

(Inherited from Vector)
InsertElementAt(Object, Int32)

Inserts the specified object as a component in this vector at the specified index.

(Inherited from Vector)
Iterator()

Returns an iterator over the elements in this list in proper sequence.

(Inherited from AbstractList)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LastElement()

Returns the last component of the vector.

(Inherited from Vector)
LastIndexOf(Object)

To be added

(Inherited from AbstractList)
LastIndexOf(Object, Int32)

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.

(Inherited from Vector)
ListIterator()

To be added

(Inherited from AbstractList)
ListIterator(Int32)

To be added

(Inherited from AbstractList)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
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.

Push(Object)

Pushes an item onto the top of this stack.

Remove(Int32)

To be added

(Inherited from AbstractList)
Remove(Object)

To be added

(Inherited from AbstractCollection)
RemoveAll(ICollection)

To be added

(Inherited from AbstractCollection)
RemoveAllElements()

Removes all components from this vector and sets its size to zero.

(Inherited from Vector)
RemoveElement(Object)

Removes the first (lowest-indexed) occurrence of the argument from this vector.

(Inherited from Vector)
RemoveElementAt(Int32)

Deletes the component at the specified index.

(Inherited from Vector)
RemoveIf(IPredicate) (Inherited from Vector)
RemoveRange(Int32, Int32)

Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.

(Inherited from AbstractList)
ReplaceAll(IUnaryOperator) (Inherited from Vector)
RetainAll(ICollection)

To be added

(Inherited from AbstractCollection)
Search(Object)

Returns the 1-based position where an object is on this stack.

Set(Int32, Object)

To be added

(Inherited from AbstractList)
SetElementAt(Object, Int32)

Sets the component at the specified index of this vector to be the specified object.

(Inherited from Vector)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetSize(Int32)

Sets the size of this vector.

(Inherited from Vector)
Size()

Returns the number of components in this vector.

(Inherited from Vector)
Sort(IComparator) (Inherited from Vector)
Spliterator()

Creates a <em>late-binding</em> and <em>fail-fast</em> Spliterator over the elements in this list.

(Inherited from Vector)
SubList(Int32, Int32)

To be added

(Inherited from AbstractList)
ToArray()

To be added

(Inherited from AbstractCollection)
ToArray(Object[])

To be added

(Inherited from AbstractCollection)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
TrimToSize()

Trims the capacity of this vector to be the vector's current size.

(Inherited from Vector)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)
ToEnumerable(IIterable)
ToEnumerable<T>(IIterable)

Applies to