|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections.primitives.BooleanStack
public class BooleanStack
A primitive boolean based Stack. The underlying backing store is an ArrayBooleanList where the front of the list is the bottom of the stack and the tail of the list is the top of the stack.
Constructor Summary | |
---|---|
BooleanStack()
Creates an empty primitive stack. |
|
BooleanStack(boolean[] bits)
Creates a stack prepopulating it with values. |
Method Summary | |
---|---|
void |
clear()
Empties the contents of the stack. |
boolean |
empty()
Tests if this stack is empty. |
boolean |
get(int index)
Gets items from the stack where the index is zero based and the top of the stack is at an index of size()-1 with the bottom of the stack at an index of 0. |
boolean |
peek()
Looks at the top of this stack without removing it. |
boolean |
peek(int n)
Return the n'th boolean down the stack, where 0 is the top element and [size()-1] is the bottom element. |
boolean |
pop()
Removes the value at the top of this stack and returns it. |
boolean |
push(boolean item)
Pushes a value onto the top of this stack. |
int |
search(boolean item)
Returns the 1-based position where a value is on this stack. |
int |
size()
Gets the size of this stack. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BooleanStack()
public BooleanStack(boolean[] bits)
bits
- the array to addMethod Detail |
---|
public boolean empty()
public boolean peek()
java.util.EmptyStackException
- if this stack is emptypublic boolean peek(int n)
n
- the element index
java.util.EmptyStackException
- if the stack is empty
java.lang.IndexOutOfBoundsException
- if the index is out of boundspublic boolean pop()
java.util.EmptyStackException
- if this stack is emptypublic boolean push(boolean item)
item
- the value to push onto this stack
public int search(boolean item)
item
- the value to search for from the top down
public boolean get(int index)
index
- the index into the stack treated as a list
public int size()
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |