Package org.apache.mina.util
Class ExpiringStack
- java.lang.Object
-
- org.apache.mina.util.ExpiringStack
-
- All Implemented Interfaces:
java.io.Serializable
public class ExpiringStack extends java.lang.Object implements java.io.Serializable
A unbounded stack with expiration.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpiringStack()
Construct a new, empty stack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears this stack.void
expireBefore(long time)
java.lang.Object
first()
Returns the first element of the stack.boolean
isEmpty()
Returnstrue
if the stack is empty.java.lang.Object
last()
java.lang.Object
pop()
Pops from this stack.void
push(java.lang.Object obj)
Push into this stack.void
remove(java.lang.Object o)
int
size()
Returns the number of elements in the stack.
-
-
-
Method Detail
-
clear
public void clear()
Clears this stack.
-
pop
public java.lang.Object pop()
Pops from this stack.- Returns:
null
, if this stack is empty or the element is reallynull
.
-
push
public void push(java.lang.Object obj)
Push into this stack.
-
remove
public void remove(java.lang.Object o)
-
expireBefore
public void expireBefore(long time)
-
first
public java.lang.Object first()
Returns the first element of the stack.- Returns:
null
, if the stack is empty, or the element is reallynull
.
-
last
public java.lang.Object last()
-
isEmpty
public boolean isEmpty()
Returnstrue
if the stack is empty.
-
size
public int size()
Returns the number of elements in the stack.
-
-