Package org.jacop.jasat.utils.structures
Class IntMap<E>
java.lang.Object
org.jacop.jasat.utils.structures.IntMap<E>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
Node that carries the data needed for a map -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clear the map (removes everything inside)boolean
containsKey
(int key) predicate to check if the key is associated to any valueget
(int key) get the value associated with the key, or nullboolean
isEmpty()
predicate to check if the map is emptyassociates key with valueboolean
remove
(int key) remove the association key/value (if any)int
size()
-
Field Details
-
map
-
-
Constructor Details
-
IntMap
public IntMap()initializes the map
-
-
Method Details
-
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
get the value associated with the key, or null- Parameters:
key
- the key- Returns:
- the value or null
-
put
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)
-