Class SentinelIntSet


  • public class SentinelIntSet
    extends Object
    A native int set where one value is reserved to mean "EMPTY"
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Field Detail

      • keys

        public int[] keys
      • count

        public int count
      • emptyVal

        public final int emptyVal
      • rehashCount

        public int rehashCount
    • Constructor Detail

      • SentinelIntSet

        public SentinelIntSet​(int size,
                              int emptyVal)
        Parameters:
        size - The minimum number of elements this set should be able to hold without re-hashing (i.e. the slots are guaranteed not to change)
        emptyVal - The integer value to use for EMPTY
    • Method Detail

      • clear

        public void clear()
      • hash

        public int hash​(int key)
      • size

        public int size()
      • getSlot

        public int getSlot​(int key)
        returns the slot for this key
      • find

        public int find​(int key)
        returns the slot for this key, or -slot-1 if not found
      • exists

        public boolean exists​(int key)
      • put

        public int put​(int key)
      • rehash

        public void rehash()