Class GridHandleTable


  • public class GridHandleTable
    extends Object
    Lightweight identity hash table which maps objects to integer handles, assigned in ascending order.
    • Constructor Detail

      • GridHandleTable

        public GridHandleTable​(int initCap,
                               float loadFactor)
        Creates new HandleTable with given capacity and load factor.
        Parameters:
        initCap - Initial capacity.
        loadFactor - Load factor.
    • Method Detail

      • putIfAbsent

        public int putIfAbsent​(Object obj)
        Looks up and returns handle associated with the given object. If the given object was not found, puts it into the table and returns -1.
        Parameters:
        obj - Object.
        Returns:
        Object's handle or -1 if it was not in the table.
      • clear

        public void clear()
        Resets table to its initial (empty) state.
      • objects

        public Object[] objects()
        Returns:
        Returns objects that were added to handles table.