Class UniqueKeyMap<K,V>
- java.lang.Object
-
- ch.sahits.game.openpatrician.utilities.collections.UniqueKeyMap<K,V>
-
- Type Parameters:
K
- KeyV
- Value
- All Implemented Interfaces:
java.util.Map<K,V>
public class UniqueKeyMap<K,V> extends java.lang.Object implements java.util.Map<K,V>
The unique key map is a map implementation where any key can only be added once. Any try to reinsert the key will result in an Exception.- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on Jul 03, 2016
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UniqueKeyMap.Node<K,V>
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,java.lang.Integer>
hashCodeIndexMap
Mapping the hashCode of the key to the index in mapData.private java.util.ArrayList<UniqueKeyMap.Node<K,V>>
mapData
-
Constructor Summary
Constructors Constructor Description UniqueKeyMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
V
get(java.lang.Object key)
boolean
isEmpty()
java.util.Set<K>
keySet()
V
put(K key, V value)
void
putAll(java.util.Map<? extends K,? extends V> m)
V
remove(java.lang.Object key)
int
size()
java.util.Collection<V>
values()
-
-
-
Field Detail
-
mapData
private java.util.ArrayList<UniqueKeyMap.Node<K,V>> mapData
-
hashCodeIndexMap
private java.util.Map<java.lang.Integer,java.lang.Integer> hashCodeIndexMap
Mapping the hashCode of the key to the index in mapData.
-
-