Class ByteArrayHashMap<T>

java.lang.Object
com.biglybt.core.util.ByteArrayHashMap<T>
Direct Known Subclasses:
RelatedContentManager.ByteArrayHashMapEx

public class ByteArrayHashMap<T> extends Object
  • Field Details

    • DEFAULT_INITIAL_CAPACITY

      static final int DEFAULT_INITIAL_CAPACITY
      The default initial capacity - MUST be a power of two.
      See Also:
    • 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:
    • DEFAULT_LOAD_FACTOR

      static final float DEFAULT_LOAD_FACTOR
      See Also:
    • table

      protected ByteArrayHashMap.Entry<T>[] table
    • size

      protected int size
    • threshold

      private int threshold
    • loadFactor

      final float loadFactor
  • Constructor Details

    • ByteArrayHashMap

      public ByteArrayHashMap(int initialCapacity, float loadFactor)
    • ByteArrayHashMap

      public ByteArrayHashMap(int initialCapacity)
    • ByteArrayHashMap

      public ByteArrayHashMap()
  • Method Details

    • 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 List<byte[]> keys()
    • values

      public List<T> values()
    • duplicate

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

      void resize(int newCapacity)
    • transfer

      void transfer(ByteArrayHashMap.Entry<T>[] newTable)
    • removeEntryForKey

      ByteArrayHashMap.Entry<T> removeEntryForKey(byte[] key)
    • 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)