|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wotonomy.foundation.internal.QueueMap
public class QueueMap
A queue based implementation of the Map interface. This class provides for
all the opertions of a map, but keeps the entries in the same sequence as
originally added. The first entry placed in the map will be the first
entry retreived during iteration: first-in, first-out (FIFO).
Keys cannot be duplicated. If an entry is made using a key that already
exists, the value for that key will be replaced with that new value. There
are no such restrictions on the values. The values may be null.
Some convenience methods are provided for the queue type operations. The
first key can be retreived as well as the last key. A key can be used
to retreive its corresponding value from the map. A value can also be used
to retreive its key from the map, however, since there may be multiple values
of the same equality, the first key found will be returned.
Nested Class Summary | |
---|---|
static class |
QueueMap.KeyValuePair
This class contains a key/value pair. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
QueueMap()
Creates an empty QueueMap. |
|
QueueMap(java.util.Map t)
Creates a QueueMap and places the entries from the passed in map into this map. |
Method Summary | |
---|---|
void |
clear()
Removes all the entries from this map. |
boolean |
containsKey(java.lang.Object key)
Tests to see if the key is contained in the map. |
boolean |
containsValue(java.lang.Object value)
Tests to see if the value is contained in the map. |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this map. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this map for equality. |
java.lang.Object |
get(java.lang.Object key)
Returns the corresponding value for the given key. |
java.lang.Object |
getFirstKey()
Returns the first key in the map. |
java.lang.Object |
getKeyForValue(java.lang.Object value)
Returns the associated key for this value. |
java.lang.Object |
getLastKey()
Returns the last key in the map. |
java.lang.Object |
getValueForKey(java.lang.Object key)
Returns the corresponding value for the given key. |
int |
hashCode()
Returns the hash code value for this map. |
boolean |
isEmpty()
Returns true is this map contains no key-value mappings. |
java.util.List |
keys()
Returns an ordered list of keys from the map. |
java.util.Set |
keySet()
Returns the keys used in the map. |
static void |
main(java.lang.String[] argv)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Places the key/value entry into the map at the end position. |
void |
putAll(java.util.Map t)
Places all the entries from this given map into this map. |
java.lang.Object |
remove(java.lang.Object key)
Remove the mapping of the key and associated value from this map. |
int |
size()
Returns the number of key/value pairs in this map. |
java.lang.String |
toString()
Returns a string reprsentation of this class. |
java.util.Collection |
values()
Returns an ordered list of values from the map. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueueMap()
public QueueMap(java.util.Map t)
t
- A map object.Method Detail |
---|
public void clear()
clear
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
equals
in class java.lang.Object
o
- object to be compared for equality with this map.
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- A key into the map.
public int hashCode()
hashCode
in interface java.util.Map
hashCode
in class java.lang.Object
public boolean isEmpty()
isEmpty
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- The key to place into the map, cannot be null.value
- The value to associate with the key, may be null.
public void putAll(java.util.Map t)
putAll
in interface java.util.Map
t
- A map of key/value entries.public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- A key to remove from the map, cannot be null.
public int size()
size
in interface java.util.Map
public java.util.List keys()
public java.util.Collection values()
values
in interface java.util.Map
public java.lang.Object getValueForKey(java.lang.Object key)
key
- A key into the map.
public java.lang.Object getKeyForValue(java.lang.Object value)
value
- A value that is contained in this map.
public java.lang.Object getFirstKey()
public java.lang.Object getLastKey()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |