Package org.jacop.jasat.utils.structures
Class IntMap<E>
- java.lang.Object
-
- org.jacop.jasat.utils.structures.IntMap<E>
-
public final class IntMap<E> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classIntMap.MapNodeNode that carries the data needed for a map
-
Field Summary
Fields Modifier and Type Field Description private IntTrie<IntMap.MapNode>map
-
Constructor Summary
Constructors Constructor Description IntMap()initializes the map
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()clear the map (removes everything inside)booleancontainsKey(int key)predicate to check if the key is associated to any valueEget(int key)get the value associated with the key, or nullbooleanisEmpty()predicate to check if the map is emptyEput(int key, E value)associates key with valuebooleanremove(int key)remove the association key/value (if any)intsize()
-
-
-
Field Detail
-
map
private final IntTrie<IntMap.MapNode> map
-
-
Method Detail
-
containsKey
public boolean containsKey(int key)
predicate to check if the key is associated to any value- Parameters:
key- the key- Returns:
- true if the key is associated to some value
-
get
public E get(int key)
get the value associated with the key, or null- Parameters:
key- the key- Returns:
- the value or null
-
put
public E put(int key, E value)
associates key with value- Parameters:
key- the keyvalue- the value- Returns:
- the old value, if any, or null
-
remove
public boolean remove(int key)
remove the association key/value (if any)- Parameters:
key- the key to remove from the Map- Returns:
- true if key was associated with some value
-
size
public int size()
- Returns:
- the number of keys in the map
-
isEmpty
public boolean isEmpty()
predicate to check if the map is empty- Returns:
- true if the map is empty, false otherwise
-
clear
public void clear()
clear the map (removes everything inside)
-
-