|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A generic hash strategy.
Custom hash structures (e.g., ObjectOpenCustomHashSet
) allow to hash objects
using arbitrary functions, a typical example being that of arrays. Of course,
one has to compare objects for equality consistently with the chosen
function. A hash strategy, thus, specifies an equality method and a hash function, with the obvious property that
equal objects must have the same hash code.
If your custom collection must be able to contain null
,
then your strategy must be able to handle null
, too. If you plan on
removing element from the collection, then your strategy must be able to handle
HashCommon.REMOVED
, too.
Method Summary | |
boolean |
equals(Object a,
Object b)
Returns true if the given objects are equal with respect to this hash strategy. |
int |
hashCode(Object o)
Returns the hash code of the specified object with respect to this hash strategy. |
Method Detail |
public int hashCode(Object o)
o
- an object (or null
).
public boolean equals(Object a, Object b)
a
- an object (or null
).b
- another object (or null
).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |