public class LRUQueue<T>
extends java.lang.Object
Constructor and Description |
---|
LRUQueue() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
contains(java.lang.Object obj)
Check if this queue contains obj
|
java.util.Enumeration<T> |
elements() |
T |
get(T obj) |
boolean |
isEmpty() |
T |
pop() |
void |
push(T obj)
push()ing an object that is already in
the queue moves that object to the most
recently used position, but doesn't add
a duplicate entry in the queue.
|
void |
pushLeast(T obj)
push to bottom (least recently used position)
|
boolean |
remove(java.lang.Object obj) |
int |
size() |
java.lang.Object[] |
toArray()
Return the objects in the queue as an array in an arbitrary and meaningless
order.
|
<E> E[] |
toArray(E[] array)
Return the objects in the queue as an array in an arbitrary and meaningless
order.
|
java.lang.Object[] |
toArrayOrdered()
Return the objects in the queue as an array.
|
<E> E[] |
toArrayOrdered(E[] array)
Return the objects in the queue as an array.
|
public final void push(T obj)
public void pushLeast(T obj)
public final T pop()
public final int size()
public final boolean remove(java.lang.Object obj)
public final boolean contains(java.lang.Object obj)
obj
- Object to matchpublic java.util.Enumeration<T> elements()
public java.lang.Object[] toArray()
public <E> E[] toArray(E[] array)
array
- The array to fill in. If it is too small a new array of the same type will be allocated.public java.lang.Object[] toArrayOrdered()
public <E> E[] toArrayOrdered(E[] array)
array
- The array to fill in. If it is too small a new array of the
same type will be allocated.public boolean isEmpty()
public void clear()