- java.lang.Object
-
- org.hsqldb.map.BaseHashMap
-
- org.hsqldb.lib.HashMap<K,V>
-
- org.hsqldb.lib.OrderedHashMap<K,V>
-
- All Implemented Interfaces:
Map<K,V>
public class OrderedHashMap<K,V> extends HashMap<K,V>
A Map which maintains the insertion order of the key/value pairs and allows access by index. Iterators return the keys or values in the index order.This class does not store null keys.
- Since:
- 1.7.2
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description OrderedHashMap()OrderedHashMap(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(K key, V value)Vget(int index)Same as getValueAt(index).intgetIndex(K key)KgetKeyAt(int index)Returns the key stored in the entry at index position.VgetValueAt(int index)Returns the value stored in the entry at index position.booleaninsert(int index, K key, V value)Vremove(java.lang.Object key)voidremoveEntry(int index)booleanset(int index, K key, V value)booleansetKeyAt(int index, K key)VsetValueAt(int index, V value)-
Methods inherited from class org.hsqldb.lib.HashMap
containsKey, containsValue, entrySet, get, keySet, keysToArray, put, putAll, remove, values, valuesToArray
-
-
-
-
Method Detail
-
getKeyAt
public K getKeyAt(int index) throws java.lang.IndexOutOfBoundsException
Returns the key stored in the entry at index position.- Parameters:
index- the index of the entry- Returns:
- the value stored in the entry
- Throws:
java.lang.IndexOutOfBoundsException- for invalid argument
-
getValueAt
public V getValueAt(int index) throws java.lang.IndexOutOfBoundsException
Returns the value stored in the entry at index position.- Parameters:
index- the index of the entry- Returns:
- the value stored in the entry
- Throws:
java.lang.IndexOutOfBoundsException- for invalid argument
-
get
public V get(int index) throws java.lang.IndexOutOfBoundsException
Same as getValueAt(index).- Parameters:
index- the index of the entry- Returns:
- the value stored in the entry
- Throws:
java.lang.IndexOutOfBoundsException- for invalid argument
-
remove
public V remove(java.lang.Object key)
-
removeEntry
public void removeEntry(int index) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
setValueAt
public V setValueAt(int index, V value) throws java.lang.IndexOutOfBoundsException
- Throws:
java.lang.IndexOutOfBoundsException
-
insert
public boolean insert(int index, K key, V value) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
set
public boolean set(int index, K key, V value) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
setKeyAt
public boolean setKeyAt(int index, K key) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
getIndex
public int getIndex(K key)
-
-