|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.HashMap<K,V> org.opengts.util.OrderedMap<K,V>
public class OrderedMap<K,V>
OrderedMap
provides a HashMap where values can also be retrieved in
the order they were added
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
OrderedMap()
Constructor |
|
OrderedMap(boolean retainOriginalValue)
Constructor |
|
OrderedMap(java.util.Map<K,V> map)
Constructor |
Method Summary | |
---|---|
void |
clear()
Clears the contents of this map |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains the specified key |
boolean |
containsKeyIgnoreCase(java.lang.String key)
Returns true if this map contains the specified case-insensitive key |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Return a set of Map.Entry elements |
V |
get(java.lang.Object key)
Gets the value for the specified key |
K |
getFirstKey()
Gets the first key. |
V |
getFirstValue()
Gets the first value. |
K |
getKey(int ndx)
Gets the key at the specified index. |
java.lang.String |
getProperty(java.lang.String key)
Gets the value for the specified key |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String dft)
Gets the value for the specified key |
V |
getValue(int ndx)
Gets the value at the specified index. |
int |
indexOfKey(java.lang.Object key)
Returns the index of the specified key in this map |
boolean |
isIgnoreCase()
Returns true if all lookups should be performed with case-insensitive keys |
K[] |
keyArray(java.lang.Class<K> arrayType)
Returns an array of key elements from this map |
java.lang.Object |
keyCaseFilter(java.lang.Object key)
Maps the specified String key to its map lookup key. |
java.util.Iterator<K> |
keyIterator()
Returns an Iterator over the keys in this map |
java.util.Set<K> |
keySet()
Returns a shallow copy of an ordered set of keys from this map (Warning: The returned 'keySet' is not backed by the map, thus any Iterator 'remove()' calls performed on the returned set will not remove the item from this map) |
OrderedSet<K> |
orderedKeySet()
Returns the ordered set of keys from this map Warning: The returned 'keySet' is not backed by the map, thus any Iterator 'remove()' calls performed on the returned set will not remove the item from this map Warning: The returned value is the actual internal Ordered Set used to maintain ordering of this ordered map. |
V |
put(int ndx,
K key,
V value)
Puts the specified key/value into the map at the specified index. |
V |
put(K key,
V value)
Puts the specified key/value into the map. |
void |
putAll(java.util.Map<? extends K,? extends V> map)
Copies the contents of the specified map into this map. Note that if the specified is not ordered, then the order in which the elements are placed into this map is unpredictable. |
void |
remove(int ndx)
Removes the key/value at the specified index |
V |
remove(java.lang.Object key)
Removes the specified key from this map. |
void |
setIgnoreCase(boolean ignoreCase)
Sets the case-insensitive key-lookup mode |
V |
setProperty(K key,
V value)
Puts the specified key/value Strings into the map. |
void |
sortKeys(java.util.Comparator<K> comp)
Sorts the key set based on the specified Comparator |
V[] |
valueArray(java.lang.Class<V> arrayType)
Returns an array of value elements from this map |
java.util.Iterator<V> |
valueIterator()
Returns an Iterator over the values in this map |
java.util.Collection<V> |
values()
Returns a Collection of values in this map |
java.util.Set<V> |
valueSet()
Returns an ordered set of values from this map |
Methods inherited from class java.util.HashMap |
---|
clone, containsValue, isEmpty, size |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
containsValue, equals, hashCode, isEmpty, size |
Constructor Detail |
---|
public OrderedMap()
public OrderedMap(boolean retainOriginalValue)
public OrderedMap(java.util.Map<K,V> map)
map
- A map from which all contents will be copiedMethod Detail |
---|
public boolean isIgnoreCase()
public void setIgnoreCase(boolean ignoreCase)
ignoreCase
- True to perform case-insensitive key lookupspublic java.lang.Object keyCaseFilter(java.lang.Object key)
key
- The key
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.HashMap<K,V>
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
entrySet
in class java.util.HashMap<K,V>
public java.util.Set<K> keySet()
keySet
in interface java.util.Map<K,V>
keySet
in class java.util.HashMap<K,V>
public OrderedSet<K> orderedKeySet()
public K[] keyArray(java.lang.Class<K> arrayType)
public java.util.Iterator<K> keyIterator()
public void sortKeys(java.util.Comparator<K> comp)
comp
- The Comparator used to sort the keySet of this mappublic java.util.Set<V> valueSet()
public V[] valueArray(java.lang.Class<V> arrayType)
public java.util.Iterator<V> valueIterator()
public java.util.Collection<V> values()
values
in interface java.util.Map<K,V>
values
in class java.util.HashMap<K,V>
public V put(int ndx, K key, V value)
ndx
- The index where the key/value are to be placedkey
- The map keyvalue
- The map value
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class java.util.HashMap<K,V>
key
- The map keyvalue
- The map value
public V setProperty(K key, V value)
key
- The map key Stringvalue
- The map value String
public void putAll(java.util.Map<? extends K,? extends V> map)
putAll
in interface java.util.Map<K,V>
putAll
in class java.util.HashMap<K,V>
map
- The map to copy to this mappublic boolean containsKeyIgnoreCase(java.lang.String key)
key
- The key
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class java.util.HashMap<K,V>
key
- The key
public int indexOfKey(java.lang.Object key)
key
- The key
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class java.util.HashMap<K,V>
key
- The key to remove
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.HashMap<K,V>
key
- The key
public java.lang.String getProperty(java.lang.String key, java.lang.String dft)
key
- The keydft
- The default value returned if the key does not exist in this map.
public java.lang.String getProperty(java.lang.String key)
key
- The key
public K getFirstKey()
public K getKey(int ndx)
ndx
- The key index
public V getFirstValue()
public V getValue(int ndx)
ndx
- The value index
public void remove(int ndx)
ndx
- The index of the key/value to remove
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |