Class ObjectRowIndexMap<Key>

java.lang.Object
com.yourkit.probes.ObjectRowIndexMap<Key>

public final class ObjectRowIndexMap<Key> extends Object
A weak map of an object to a row index which is a positive integer value. Like an ordinary weak key map, this map does not prevent its keys from being discarded by the garbage collector. Unlike an ordinary weak key map, this map can be used (keeps the stored mapping) even inside the key's finalize() method.
  • Constructor Details

    • ObjectRowIndexMap

      public ObjectRowIndexMap()
  • Method Details

    • put

      public int put(@NotNull Key key, int value)
      Parameters:
      key - key with which the specified value is to be associated
      value - index to be associated with the specified key
      Returns:
      previously mapped row index, or Table.NO_ROW if no row was mapped to the object
    • putAtomic

      public boolean putAtomic(@NotNull Key key, int newValue, int expectedValue)
      Parameters:
      key - key with which the specified newValue is to be associated
      newValue - index to be associated with the specified key
      expectedValue - the mapping will be changed only if the current mapping is expectedValue
      Returns:
      true if mapping has been changed
    • putFirst

      public boolean putFirst(@NotNull Key key, int newValue)
    • get

      public int get(@NotNull Key key)
      Parameters:
      key - the key whose associated index is to be returned
      Returns:
      mapped row index, or Table.NO_ROW if no row is mapped to the object
    • containsKey

      public boolean containsKey(@NotNull Key key)
    • remove

      public int remove(@NotNull Key key)
      Parameters:
      key - the key whose associated index is to be removed
      Returns:
      previously mapped row index, or Table.NO_ROW if no row was mapped to the object