public class MapInt<E>
extends java.lang.Object
int,
represented concretely by an integer wrapper class.
By default the underlying Map implementation used is
a TreeMap.| Modifier and Type | Class and Description |
|---|---|
static class |
MapInt.Int
Wrapper class for an integer, acting a
MapInt key. |
| Constructor and Description |
|---|
MapInt()
Constructs a new
MapInt, using a new TreeMap instance. |
MapInt(java.util.Map<MapInt.Int,E> mp)
Constructs a new
MapInt using the given Map. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears this map.
|
E |
get(int k)
Returns the value to which the given key is mapped, or
null
if none. |
static MapInt.Int.Comp |
getIntComp()
Returns a comparator for the built-in integer wrapper class.
|
void |
getValues(E[] values)
Places the values in this map in the given array, which should be of
the correct size, i.e.
|
int[] |
keys()
Returns this map's key set as an array of
int. |
void |
put(int k,
E val)
Updates this map with an entry mapping the given key to the given value.
|
void |
setMap(java.util.Map<MapInt.Int,E> mp)
Sets the underlying
Map for this IntMap. |
int |
size()
Returns the size of this map.
|
public MapInt(java.util.Map<MapInt.Int,E> mp)
MapInt using the given Map.public MapInt()
MapInt, using a new TreeMap instance.public static final MapInt.Int.Comp getIntComp()
public void setMap(java.util.Map<MapInt.Int,E> mp)
Map for this IntMap.public void clear()
public int size()
public void put(int k,
E val)
public void getValues(E[] values)
size().public E get(int k)
null
if none.public int[] keys()
int.