java.lang.Object
net.i2p.router.util.DecayingHashSet.ArrayWrapper
- Enclosing class:
DecayingHashSet
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 Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionArrayWrapper(byte[] b, int offset, int len) Wraps part of a byte array.ArrayWrapper(long b) Faster version for when storing 8 bytes or fewer.Method Summary
All Methods
Field Details
_longhashcode
private final long _longhashcodeThe 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 wrapoffset- where the wrapped part startslen- 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
longHashCode
public long longHashCode()The hash of the wrapped data.- Returns:
- the hash as a long
equals