Class ByteArrayHashMap<T>

    • Field Detail

      • DEFAULT_INITIAL_CAPACITY

        static final int DEFAULT_INITIAL_CAPACITY
        The default initial capacity - MUST be a power of two.
        See Also:
        Constant Field Values
      • MAXIMUM_CAPACITY

        static final int MAXIMUM_CAPACITY
        The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments. MUST be a power of two <= 1<<30.
        See Also:
        Constant Field Values
      • size

        protected int size
      • threshold

        private int threshold
      • loadFactor

        final float loadFactor
    • Constructor Detail

      • ByteArrayHashMap

        public ByteArrayHashMap​(int initialCapacity,
                                float loadFactor)
      • ByteArrayHashMap

        public ByteArrayHashMap​(int initialCapacity)
      • ByteArrayHashMap

        public ByteArrayHashMap()
    • Method Detail

      • size

        public int size()
      • isEmpty

        public boolean isEmpty()
      • get

        public T get​(byte[] key,
                     int offset,
                     int len)
      • get

        public T get​(byte[] key)
      • containsKey

        public boolean containsKey​(byte[] key)
      • put

        public T put​(byte[] key,
                     T value)
      • remove

        public T remove​(byte[] key)
      • clear

        public void clear()
      • keys

        public java.util.List<byte[]> keys()
      • values

        public java.util.List<T> values()
      • duplicate

        public ByteArrayHashMap<T> duplicate()
        Bit inefficient at the moment
        Returns:
      • resize

        void resize​(int newCapacity)
      • addEntry

        void addEntry​(int hash,
                      byte[] key,
                      T value,
                      int bucketIndex)
      • createEntry

        void createEntry​(int hash,
                         byte[] key,
                         T value,
                         int bucketIndex)
      • hash

        private static int hash​(byte[] x)
      • eq

        private static boolean eq​(byte[] x,
                                  byte[] y)
      • indexFor

        private static int indexFor​(int h,
                                    int length)