Here you can find the source of hashCodeSafe(final Object value)
Parameter | Description |
---|---|
value | The value to get the hash code for. May be null. |
public static int hashCodeSafe(final Object value)
//package com.java2s; /*//from w w w .j a va2 s. c o m * File: ObjectUtil.java * Authors: Justin Basilico * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright June 28, 2007, Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000, there is a non-exclusive license for use of this work by * or on behalf of the U.S. Government. Export of this program may require a * license from the United States Government. See CopyrightHistory.txt for * complete details. * */ public class Main { /** * Determines the hash code of the given value by calling the hashCode * method on the given object if it is not null. If it is null, 0 is * returned. * * @param value * The value to get the hash code for. May be null. * @return * The hash code of the given value if it is not null; otherwise, 0. */ public static int hashCodeSafe(final Object value) { if (value == null) { return 0; } else { return value.hashCode(); } } }