Class IntKeyMap<V>

java.lang.Object
org.jboss.marshalling.util.IntKeyMap<V>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<IntKeyMap.Entry<V>>

public final class IntKeyMap<V> extends Object implements Cloneable, Serializable, Iterable<IntKeyMap.Entry<V>>
An integer-keyed map, optimized for fast copying. Based on FastCopyHashMap by Jason T. Greene.
See Also:
  • Field Details

    • DEFAULT_CAPACITY

      private static final int DEFAULT_CAPACITY
      Same default as HashMap, must be a power of 2
      See Also:
    • MAXIMUM_CAPACITY

      private static final int MAXIMUM_CAPACITY
      MAX_INT - 1
      See Also:
    • DEFAULT_LOAD_FACTOR

      private static final float DEFAULT_LOAD_FACTOR
      67%, just like IdentityHashMap
      See Also:
    • table

      private transient IntKeyMap.Entry<V>[] table
      The open-addressed table
    • size

      private transient int size
      The current number of key-value pairs
    • threshold

      private transient int threshold
      The next resize
    • loadFactor

      private final float loadFactor
      The user defined load factor which defines when to resize
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
  • Constructor Details

    • IntKeyMap

      public IntKeyMap(int initialCapacity, float loadFactor)
    • IntKeyMap

      public IntKeyMap(IntKeyMap<? extends V> map)
    • IntKeyMap

      public IntKeyMap(int initialCapacity)
    • IntKeyMap

      public IntKeyMap()
  • Method Details

    • init

      private void init(int initialCapacity, float loadFactor)
    • nextIndex

      private int nextIndex(int index, int length)
    • eq

      private static boolean eq(Object o1, Object o2)
    • index

      private static int index(int hashCode, int length)
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • get

      public V get(int key)
    • containsKey

      public boolean containsKey(int key)
    • containsValue

      public boolean containsValue(Object value)
    • put

      public V put(int key, V value)
    • resize

      private void resize(int from)
    • remove

      public V remove(int key)
    • relocate

      private void relocate(int start)
    • clear

      public void clear()
    • clone

      public IntKeyMap<V> clone()
      Overrides:
      clone in class Object
    • printDebugStats

      public void printDebugStats()
    • readObject

      private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException
    • putForCreate

      private void putForCreate(int key, V value)
    • writeObject

      private void writeObject(ObjectOutputStream s) throws IOException
      Throws:
      IOException
    • iterator

      public Iterator<IntKeyMap.Entry<V>> iterator()
      Iterate over the entries. Read-only operation.
      Specified by:
      iterator in interface Iterable<V>
      Returns:
      the entry iterator