Example usage for java.lang Object hashCode

List of usage examples for java.lang Object hashCode

Introduction

In this page you can find the example usage for java.lang Object hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:com.clark.func.Functions.java

/**
 * <p>/*from  w  w  w. j a v  a  2  s . com*/
 * Gets the hash code of an object returning zero when the object is
 * <code>null</code>.
 * </p>
 * 
 * <pre>
 * ObjectUtils.hashCode(null)   = 0
 * ObjectUtils.hashCode(obj)    = obj.hashCode()
 * </pre>
 * 
 * @param obj
 *            the object to obtain the hash code of, may be
 *            <code>null</code>
 * @return the hash code of the object, or zero if null
 * @since 2.1
 */
public static int objectHashCode(Object obj) {
    return (obj == null) ? 0 : obj.hashCode();
}