jautil
Class MapInt<E>

java.lang.Object
  extended by jautil.MapInt<E>

public class MapInt<E>
extends java.lang.Object

A generic map whose conceptual domain type is int, represented concretely by an integer wrapper class. By default the underlying Map implementation used is a TreeMap.


Nested Class Summary
static class MapInt.Int
          Wrapper class for an integer, acting a MapInt key.
 
Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapInt

public MapInt(java.util.Map<MapInt.Int,E> mp)
Constructs a new MapInt using the given Map.


MapInt

public MapInt()
Constructs a new MapInt, using a new TreeMap instance.

Method Detail

getIntComp

public static final MapInt.Int.Comp getIntComp()
Returns a comparator for the built-in integer wrapper class.


setMap

public void setMap(java.util.Map<MapInt.Int,E> mp)
Sets the underlying Map for this IntMap.


clear

public void clear()
Clears this map.


size

public int size()
Returns the size of this map.


put

public void put(int k,
                E val)
Updates this map with an entry mapping the given key to the given value.


getValues

public void getValues(E[] values)
Places the values in this map in the given array, which should be of the correct size, i.e. that given by size().


get

public E get(int k)
Returns the value to which the given key is mapped, or null if none.


keys

public int[] keys()
Returns this map's key set as an array of int.