java.lang.Object
net.i2p.router.util.DecayingHashSet.ArrayWrapper
Enclosing class:
DecayingHashSet

private static class DecayingHashSet.ArrayWrapperextends Object
This saves the data as-is if the length is <= 8 bytes, otherwise it stores an 8-byte hash. Hash function is from DataHelper, modded to get the maximum entropy given the length of the data.
  • Field Details

    • _longhashcode

      private final long _longhashcode
      The hash of the wrapped bytes.
  • Constructor Details

    • ArrayWrapper

      public ArrayWrapper(byte[] b, int offset, int len)
      Wraps part of a byte array.
      Parameters:
      b - the array to wrap
      offset - where the wrapped part starts
      len - the length of the wrapped part
    • ArrayWrapper

      public ArrayWrapper(long b)
      Faster version for when storing 8 bytes or fewer.
      Parameters:
      b - the entry as a long value
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • longHashCode

      public long longHashCode()
      The hash of the wrapped data.
      Returns:
      the hash as a long
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object