K
- the type of the keyV
- the type of the valuepublic class OrderedFastHashMap<K,V> extends Object implements Map<K,V>, Serializable
Constructor and Description |
---|
OrderedFastHashMap()
Default constructor which create an ordered map with default size.
|
OrderedFastHashMap(int size)
Custom constructor to get a map with a custom size and fill factor.
|
Modifier and Type | Method and Description |
---|---|
V |
add(K key,
V value) |
V |
addFirst(K key,
V value) |
V |
addLast(K key,
V value) |
void |
clear()
Clears the map, reuses the data structure by clearing it out.
|
boolean |
containsKey(Object key)
Checks of a key is in the map.
|
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key)
Get a value for a key, any key type is permitted due to
the nature of the Map interface.
|
org.htmlunit.util.OrderedFastHashMap.Entry<K,V> |
getEntry(int index)
Returns an entry consisting of key and value at a given position.
|
V |
getFirst() |
K |
getKey(int index)
Returns the key at a certain position of the ordered list that
keeps the addition order of this map.
|
V |
getLast() |
V |
getValue(int index)
Returns the value at a certain position of the ordered list that
keeps the addition order of this map.
|
boolean |
isEmpty() |
List<K> |
keys()
Returns a list of all keys in order of addition.
|
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> src) |
V |
remove(int index)
Removes a key and value from this map based on the position
in the backing list, rather by key as usual.
|
V |
remove(Object key)
Remove a key from the map.
|
V |
removeFirst() |
V |
removeLast() |
void |
reverse()
Just reverses the ordering of the map as created so far.
|
int |
size()
Returns the size of the map, effectively the number of entries.
|
String |
toString() |
List<V> |
values()
Returns a list of all values ordered by when the key was
added.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public OrderedFastHashMap()
public OrderedFastHashMap(int size)
size
- the size to use, must 0 or positive, negative values default to 0public V get(Object key)
public V remove(Object key)
public int size()
public List<K> keys()
public List<V> values()
public void clear()
public org.htmlunit.util.OrderedFastHashMap.Entry<K,V> getEntry(int index)
index
- the position to fetchIndexOutOfBoundsException
- when the ask for the position is invalidpublic K getKey(int index)
index
- the position to fetchIndexOutOfBoundsException
- when the ask for the position is invalidpublic V getValue(int index)
index
- the position to fetchIndexOutOfBoundsException
- when the ask for the position is invalidpublic V remove(int index)
index
- the position to remove the data fromIndexOutOfBoundsException
- when the ask for the position is invalidpublic V getFirst()
public V getLast()
public V removeFirst()
public V removeLast()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
key
- the key to checkpublic boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public void reverse()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.