|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<K,V>
com.sibvisions.util.OrderedHashtable<K,V>
K
- the key object typeV
- the value object typepublic class OrderedHashtable<K,V>
The OrderedHashtable
extends a Hashtable
and keeps
the add order. It works according to the FiFo principle. The first key
added is the first key in the key list.
Hashtable
,
Serialized FormConstructor Summary | |
---|---|
OrderedHashtable()
Creates a new instance of OrderedHashtable with a default
initial capacity (11) and load factor (0.75). |
|
OrderedHashtable(int pCapacity)
Creates a new instance of OrderedHashtable with the specified initial
capacity and default load factor (0.75). |
|
OrderedHashtable(int pCapacity,
float pLoadFactor)
Creates a new instance of OrderedHashtable with the specified initial
capacity and the specified load factor. |
|
OrderedHashtable(Map<? extends K,? extends V> pMap)
Creates a new instance of OrderedHashtable with the same mappings
as the given Map . |
Method Summary | |
---|---|
void |
clear()
|
Object |
clone()
Creates a shallow copy of this hashtable. |
K |
getKey(int pIndex)
Gets a key by index. |
Enumeration<K> |
keys()
Returns an enumeration of the keys in this hashtable. |
V |
put(K pKey,
V pValue)
Maps the specified pKey to the specified
pValue in this hashtable. |
V |
remove(Object pKey)
Removes the key (and its corresponding value) from this hashtable. |
Methods inherited from class java.util.Hashtable |
---|
contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OrderedHashtable()
OrderedHashtable
with a default
initial capacity (11) and load factor (0.75).
Hashtable.Hashtable()
public OrderedHashtable(int pCapacity)
OrderedHashtable
with the specified initial
capacity and default load factor (0.75).
pCapacity
- the initial capacity of the hashtable
IllegalArgumentException
- if the initial capacity is less than zeroHashtable.Hashtable(int)
public OrderedHashtable(int pCapacity, float pLoadFactor)
OrderedHashtable
with the specified initial
capacity and the specified load factor.
pCapacity
- the initial capacity of the hashtablepLoadFactor
- the load factor of the hashtable
IllegalArgumentException
- if the initial capacity is less than zero,
or if the load factor is nonpositive.Hashtable.Hashtable(int, float)
public OrderedHashtable(Map<? extends K,? extends V> pMap)
OrderedHashtable
with the same mappings
as the given Map
. The hashtable is created with an initial capacity sufficient
to hold the mappings in the given Map
and a default load factor (0.75).
pMap
- the map whose mappings are to be placed in this map.
NullPointerException
- if the specified map is null.Method Detail |
---|
public V put(K pKey, V pValue)
pKey
to the specified
pValue
in this hashtable. Neither the key nor the
value can be null
.
The value can be retrieved by calling the get
method
with a key that is equal to the original key.
The order will be stored to guarantee the FiFo principle.
put
in interface Map<K,V>
put
in class Hashtable<K,V>
pKey
- the hashtable keypValue
- the value
null
if it did not have one
NullPointerException
- if the key or value is null
Hashtable.get(Object)
public V remove(Object pKey)
remove
in interface Map<K,V>
remove
in class Hashtable<K,V>
pKey
- the key that needs to be removed
null
if the key did not have a mapping
NullPointerException
- if the key is null
public Object clone()
clone
in class Hashtable<K,V>
public void clear()
clear
in interface Map<K,V>
clear
in class Hashtable<K,V>
public Enumeration<K> keys()
keys
in class Hashtable<K,V>
public K getKey(int pIndex)
pIndex
- the index of the key
ArrayIndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |