|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scijava.util.LastRecentlyUsed<T>
public class LastRecentlyUsed<T>
A simple container for N
last-recently-used items.
Constructor Summary | |
---|---|
LastRecentlyUsed(int size)
|
Method Summary | ||
---|---|---|
boolean |
add(T value)
Add a new newest entry. |
|
boolean |
addAll(Collection<? extends T> values)
|
|
void |
addToEnd(T value)
Add a new oldest entry. |
|
protected void |
assertConsistency()
|
|
void |
clear()
Empties the data structure. |
|
boolean |
contains(Object value)
|
|
boolean |
containsAll(Collection<?> values)
|
|
T |
get(int index)
Returns the entry for the given index. |
|
boolean |
isEmpty()
|
|
Iterator<T> |
iterator()
Returns an Iterator . |
|
int |
lookup(T value)
Looks up the index for a given entry. |
|
int |
next(int index)
Given the index of an entry, returns the index of the next newer entry. |
|
int |
previous(int index)
Given the index of an entry, returns the index of the next older entry. |
|
boolean |
remove(Object value)
|
|
boolean |
removeAll(Collection<?> values)
|
|
boolean |
replace(int index,
T newValue)
|
|
boolean |
retainAll(Collection<?> values)
|
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(S[] array)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public LastRecentlyUsed(int size)
Method Detail |
---|
public int next(int index)
index
- the index of the current entry, or -1 to wrap around to the oldest entry.
public int previous(int index)
index
- the index of the current entry, or -1 to wrap around to the newest entry.
public T get(int index)
index
- the index of the entry
public int lookup(T value)
value
- the value of the entry to find
-1
if the entry was not foundpublic boolean add(T value)
add
in interface Collection<T>
value
- the value of the entry
public void addToEnd(T value)
This method helps recreating LastRecentlyUsed
instances given the
entries in the order newest first, oldest last.
value
- the value of the entry to addpublic boolean replace(int index, T newValue)
public void clear()
clear
in interface Collection<T>
public boolean addAll(Collection<? extends T> values)
addAll
in interface Collection<T>
public boolean contains(Object value)
contains
in interface Collection<T>
public boolean containsAll(Collection<?> values)
containsAll
in interface Collection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
public boolean remove(Object value)
remove
in interface Collection<T>
public boolean removeAll(Collection<?> values)
removeAll
in interface Collection<T>
public boolean retainAll(Collection<?> values)
retainAll
in interface Collection<T>
public int size()
size
in interface Collection<T>
public Object[] toArray()
toArray
in interface Collection<T>
public <S> S[] toArray(S[] array)
toArray
in interface Collection<T>
public Iterator<T> iterator()
Iterator
.
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
protected void assertConsistency()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |