Class ArrayBasedStack<T>
java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.ArrayBasedStack<T>
Array-based Stack.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
This class is not thread-safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_CAPACITY
static final int DEFAULT_CAPACITY- See Also:
-
array
-
size
private int size
-
-
Constructor Details
-
ArrayBasedStack
public ArrayBasedStack()
-
-
Method Details
-
push
Addelement
to the top of the stack (LIFO).- Parameters:
element
- The element to add- Throws:
NullPointerException
- ifelement
is null
-
pop
Removes and returns an element from the top of the stack (LIFO).- Returns:
- the top most element in the stack (last one added)
-
isEmpty
public boolean isEmpty() -
size
public int size() -
resizeArray
private void resizeArray(int newCapacity)
-