Class IntMap<E>

java.lang.Object
org.jacop.jasat.utils.structures.IntMap<E>

public final class IntMap<E> extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private final class 
    Node that carries the data needed for a map
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final IntTrie<IntMap<E>.MapNode>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    initializes the map
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clear the map (removes everything inside)
    boolean
    containsKey(int key)
    predicate to check if the key is associated to any value
    get(int key)
    get the value associated with the key, or null
    boolean
    predicate to check if the map is empty
    put(int key, E value)
    associates key with value
    boolean
    remove(int key)
    remove the association key/value (if any)
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      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 key
      value - 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)