Class DenseIntMapImpl<E>

  • All Implemented Interfaces:
    IntMap<E>

    public class DenseIntMapImpl<E>
    extends java.lang.Object
    implements IntMap<E>
    Utility for managing mappings from densely allocated integer keys to arbitrary objects. This should only be used for keys in the range 0..max such that "most" of the key space is actually used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<E> list  
    • Constructor Summary

      Constructors 
      Constructor Description
      DenseIntMapImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkKey​(int key)  
      private void extend​(int index)  
      E get​(int key)
      If key >= 0, return the value bound to key, or null if none.
      void set​(int key, E value)
      If key >= 0, bind value to the key.
      • Methods inherited from class java.lang.Object

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

      • list

        private java.util.ArrayList<E> list
    • Constructor Detail

      • DenseIntMapImpl

        public DenseIntMapImpl()
    • Method Detail

      • checkKey

        private void checkKey​(int key)
      • get

        public E get​(int key)
        If key >= 0, return the value bound to key, or null if none. Throws IllegalArgumentException if key <0.
        Specified by:
        get in interface IntMap<E>
      • set

        public void set​(int key,
                        E value)
        If key >= 0, bind value to the key. Throws IllegalArgumentException if key <0.
        Specified by:
        set in interface IntMap<E>
      • extend

        private void extend​(int index)