Class Striped.PowerOfTwoStriped<L>

java.lang.Object
com.google.common.util.concurrent.Striped<L>
com.google.common.util.concurrent.Striped.PowerOfTwoStriped<L>
Direct Known Subclasses:
Striped.CompactStriped, Striped.LargeLazyStriped, Striped.SmallLazyStriped
Enclosing class:
Striped<L>

private abstract static class Striped.PowerOfTwoStriped<L> extends Striped<L>
  • Field Details

    • mask

      final int mask
      Capacity (power of two) minus one, for fast mod evaluation
  • Constructor Details

    • PowerOfTwoStriped

      PowerOfTwoStriped(int stripes)
  • Method Details

    • indexFor

      final int indexFor(Object key)
      Description copied from class: Striped
      Returns the index to which the given key is mapped, so that getAt(indexFor(key)) == get(key).
      Specified by:
      indexFor in class Striped<L>
    • get

      public final L get(Object key)
      Description copied from class: Striped
      Returns the stripe that corresponds to the passed key. It is always guaranteed that if key1.equals(key2), then get(key1) == get(key2).
      Specified by:
      get in class Striped<L>
      Parameters:
      key - an arbitrary, non-null key
      Returns:
      the stripe that the passed key corresponds to