Package com.groiss.ds
Class OrderedMap<K,V>
java.lang.Object
com.groiss.ds.OrderedMap<K,V>
A map implementation where they keys are backed by a hashmap.
Removal of keys is disallowed.
Duplicate keys are disallowed at construction time.
Changing a value for a key is allowed.
Additional keys are allowed.
All clones of an instance share the same keys.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clone()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
int
getPosition
(K key) boolean
isEmpty()
keySet()
void
int
size()
toString()
values()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
OrderedMap
Create a new OrderedList.- Parameters:
keyList
- a list of keys for the map; duplicates are disallowed.
-
-
Method Details
-
clear
public void clear() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
entrySet
-
getPosition
-
clone
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
getValueList
-
toString
-