Package org.jfree.util
Class FastStack
- java.lang.Object
-
- org.jfree.util.FastStack
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public final class FastStack extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
A very simple unsynchronized stack. This one is faster than the java.util-Version.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the stack.java.lang.Objectclone()Returns a clone of the stack.java.lang.Objectget(int index)Returns the item at the specified slot in the stack.booleanisEmpty()Returnstrueif the stack is empty, andfalseotherwise.java.lang.Objectpeek()Returns the object at the top of the stack without removing it.java.lang.Objectpop()Removes and returns the object from the top of the stack.voidpush(java.lang.Object o)Pushes an object onto the stack.intsize()Returns the number of elements in the stack.
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returnstrueif the stack is empty, andfalseotherwise.- Returns:
- A boolean.
-
size
public int size()
Returns the number of elements in the stack.- Returns:
- The element count.
-
push
public void push(java.lang.Object o)
Pushes an object onto the stack.- Parameters:
o- the object.
-
peek
public java.lang.Object peek()
Returns the object at the top of the stack without removing it.- Returns:
- The object at the top of the stack.
-
pop
public java.lang.Object pop()
Removes and returns the object from the top of the stack.- Returns:
- The object.
-
clone
public java.lang.Object clone()
Returns a clone of the stack.- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
-
clear
public void clear()
Clears the stack.
-
get
public java.lang.Object get(int index)
Returns the item at the specified slot in the stack.- Parameters:
index- the index.- Returns:
- The item.
-
-