Example usage for org.apache.commons.lang ObjectUtils hashCode

List of usage examples for org.apache.commons.lang ObjectUtils hashCode

Introduction

In this page you can find the example usage for org.apache.commons.lang ObjectUtils hashCode.

Prototype

public static int hashCode(Object obj) 

Source Link

Document

Gets the hash code of an object returning zero when the object is null.

 ObjectUtils.hashCode(null)   = 0 ObjectUtils.hashCode(obj)    = obj.hashCode() 

Usage

From source file:org.openhab.binding.astro.internal.bus.PlanetPublisher.java

/**
 * Returns true, if the cached value is equal to the new value.
 *//*from   ww w .  j  ava  2 s.  c  o m*/
private boolean equalsCachedValue(Object value, Item item) {
    int cachedValueHashCode = ObjectUtils.hashCode(itemCache.get(item.getName()));
    int valueHashCode = ObjectUtils.hashCode(value);
    return cachedValueHashCode == valueHashCode;
}

From source file:sg.atom.utils.datastructure.tuple.Tuple.java

@Override
public int hashCode() {
    if (this.size == 0) {
        return 0;
    } else if (this.size == 1) {
        return ObjectUtils.hashCode(this.entries[0]);
    } else {//from ww  w  . ja  v  a 2 s.  co m
        int hashCode = 1;
        for (Object entry : this.entries) {
            hashCode = hashCode ^ ObjectUtils.hashCode(entry);
        }
        return hashCode;
    }
}