Class LongHashMap<T>

  • Type Parameters:
    T - The value class to store.
    Direct Known Subclasses:
    LongHashMap.Synchronized

    public class LongHashMap<T>
    extends java.lang.Object
    An minimalistic hash map optimized for long keys. The default implementation is not thread-safe, but you can get a synchronized variant using one of the static createSynchronized methods.
    • Field Detail

      • capacity

        private int capacity
      • threshold

        private int threshold
      • size

        private volatile int size
    • Constructor Detail

      • LongHashMap

        public LongHashMap()
      • LongHashMap

        public LongHashMap​(int capacity)
    • Method Detail

      • createSynchronized

        public static <T> LongHashMap<T> createSynchronized()
        Creates a synchronized (thread-safe) LongHashSet.
      • createSynchronized

        public static <T> LongHashMap<T> createSynchronized​(int capacity)
        Creates a synchronized (thread-safe) LongHashSet using the given initial capacity.
      • containsKey

        public boolean containsKey​(long key)
      • get

        public T get​(long key)
      • put

        public T put​(long key,
                     T value)
      • remove

        public T remove​(long key)
      • keys

        public long[] keys()
        Returns all keys in no particular order.
      • entries

        public LongHashMap.Entry<T>[] entries()
        Returns all entries in no particular order.
      • clear

        public void clear()
      • size

        public int size()
      • setCapacity

        public void setCapacity​(int newCapacity)
      • reserveRoom

        public void reserveRoom​(int entryCount)
        Target load: 0,6