Java Utililty Methods List Hash

List of utility methods to do List Hash

Description

The list of methods to do List Hash are organized into topic(s).

Method

inthashCode(List list)
hash Code
if (list == null) {
    return 0;
final int prime = 31;
int result = 1;
for (Iterator it = list.iterator(); it.hasNext();) {
    result = prime * result + it.next().hashCode();
return result;
inthashCode(List list)
Computes the hash code for a list per the contract defined by List#hashCode() .
return listHashCode(list);
inthashCodeForList(final Collection list)
Generates a hash code using the algorithm specified in java.util.List#hashCode() .
if (list == null) {
    return 0;
int hashCode = 1;
Iterator it = list.iterator();
Object obj = null;
while (it.hasNext()) {
    obj = it.next();
...
inthashContents(List l)
finds a hash value which takes into account the value of all elements, such that two sets for which equivalent(a, b) returns true will hashContents() to the same value
int out = 0;
int count = 0;
for (Iterator ii = l.iterator(); ii.hasNext(); ++count) {
    Object o = ii.next();
    if (o != null)
        out ^= (o.hashCode() ^ count);
return out;
...