public class IntStack extends IntVector
Stack
pretty closely, except that push()
returns the position of the added element in the stack. Inherits from IntVector, so those methods
are also available.Constructor and Description |
---|
IntStack()
Creates an empty stack.
|
IntStack(int capacity)
Creates an empty stack.
|
IntStack(int capacity,
int growth_factor,
int multiplication_limit)
Creates an empty stack with specified capacity, growth_factor and multiplication limit
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the stack.
|
boolean |
empty()
Check if stack is empty.
|
int |
peek()
Look at the topmost element in the stack.
|
int |
pop()
Pop an element from the stack.
|
int |
push(int i)
Push a new element on the stack.
|
add, add, add, add, contains, copy, ensure_size, equals, fill, get, getArray, hashCode, indexOf, indexOfOptimizeAscending, position, put, remove, removeAllElements, set, setSize, size, sortDedup, toArray, toArrayCopy, toString, trimToSize
public IntStack()
public IntStack(int capacity)
public IntStack(int capacity, int growth_factor, int multiplication_limit)
public int push(int i)
i
- The element to be pushed.i
after it's been added.public int pop()
public int peek()
public boolean empty()
true
, if stack is empty; false
, else.public void clear()
Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.