Class IntMap<E>


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

      Nested Classes 
      Modifier and Type Class Description
      private class  IntMap.MapNode
      Node that carries the data needed for a map
    • Constructor Summary

      Constructors 
      Constructor Description
      IntMap()
      initializes the map
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      clear the map (removes everything inside)
      boolean containsKey​(int key)
      predicate to check if the key is associated to any value
      E get​(int key)
      get the value associated with the key, or null
      boolean isEmpty()
      predicate to check if the map is empty
      E put​(int key, E value)
      associates key with value
      boolean remove​(int key)
      remove the association key/value (if any)
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntMap

        public IntMap()
        initializes the map
    • Method Detail

      • 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)