public class IntMap extends Object
Created by cprudhom on 20/10/2015. Project: choco.
Constructor and Description |
---|
IntMap() |
IntMap(int initialCapacity) |
IntMap(int initialCapacity,
int no_value) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from this map.
|
void |
clear(int key)
Remove the value to which the specified key is mapped.
|
boolean |
containsKey(int key)
Returns true if this map contains a mapping for the
specified key.
|
int |
get(int key)
Returns the value to which the specified key is mapped,
or
-1 if this map contains no mapping for the key. |
boolean |
isEmpty()
Returns true if this map contains no elements.
|
void |
put(int key,
int value)
Associates the specified value with the specified key in this map.
|
void |
putOrAdjust(int key,
int value,
int inc)
Adjusts the specified value associated with the specified key in this map.
|
int |
size()
Returns the number of elements in this map.
|
public IntMap()
public IntMap(int initialCapacity)
public IntMap(int initialCapacity, int no_value)
public int size()
public boolean isEmpty()
public void put(int key, int value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic void putOrAdjust(int key, int value, int inc)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyinc
- increment to add to the value associated with the keypublic int get(int key)
-1
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k
to a value v
such that (key==-1 ? k==-1 :
key == k)
, then this method returns v
; otherwise
it returns -1
. (There can be at most one such mapping.)
A return value of #FREE
necessarily
indicate that the map contains no mapping for the key.
put(int, int)
public boolean containsKey(int key)
key
- The key whose presence in this map is to be testedpublic void clear(int key)
key
- key with which the specified value is to be clearedpublic void clear()
Copyright © 2018. All rights reserved.