| com.go.trove.util.UsageMap
UsageMap | public class UsageMap extends AbstractMap implements java.io.Serializable(Code) | | A Map that orders its keys based on how recently they have been used.
Most recently used keys appear first in the Map. Keys are marked as being
used whenever they are put into to the Map. To re-position a key, put it
back in.
parametrized for GJ by Stefan Reich (doc@drjava.de);
removed putAll because it doesn't conform to the overridden definition
of putAll in Map
author: Brian S O'Neill version: , 9/07/00 |
Constructor Summary | |
public | UsageMap() Creates a UsageMap in forward order, MRU first. | public | UsageMap(Map backingMap) |
Method Summary | |
public void | clear() | public boolean | containsKey(A key) | public Set<Map.Entry<A, B>> | entrySet() | public A | firstKey() Returns the first key in the map, the most recently used. | public B | get(A key) | public boolean | isEmpty() | public A | lastKey() Returns the last key in the map, the least recently used. | public B | put(A key, B value) | public B | remove(A key) | public void | setReverseOrder(boolean reverse) With reverse order, keys are ordered least recently used first. | public int | size() |
UsageMap | public UsageMap()(Code) | | Creates a UsageMap in forward order, MRU first.
|
UsageMap | public UsageMap(Map backingMap)(Code) | | Parameters: backingMap - map to use for storage |
clear | public void clear()(Code) | | |
containsKey | public boolean containsKey(A key)(Code) | | |
firstKey | public A firstKey() throws NoSuchElementException(Code) | | Returns the first key in the map, the most recently used. If reverse
order, then the least recently used is returned.
|
isEmpty | public boolean isEmpty()(Code) | | |
lastKey | public A lastKey() throws NoSuchElementException(Code) | | Returns the last key in the map, the least recently used. If reverse
order, then the most recently used is returned.
|
put | public B put(A key, B value)(Code) | | |
remove | public B remove(A key)(Code) | | |
setReverseOrder | public void setReverseOrder(boolean reverse)(Code) | | With reverse order, keys are ordered least recently used first. The
ordering of the map entries will be consistent with the order they were
put into it. Switching to and from reverse order is performed quickly
and is not affected by the current size of the map.
|
|
|