Java Hash Code Calculate hashCode(Object object)

Here you can find the source of hashCode(Object object)

Description

Convenience method that returns the hashCode() of object.

License

Apache License

Parameter

Parameter Description
object the object for which to return the hashcode

Return

the hashcode value or 0 if object is null

Declaration

public static int hashCode(Object object) 

Method Source Code

//package com.java2s;
/*// ww w  .  jav a 2  s  . com
Copyright 1996-2013 Ariba, Inc.
    
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    
$Id: //ariba/platform/util/core/ariba/util/core/SystemUtil.java#39 $
*/

public class Main {
    /**
    Convenience method that returns the <code>hashCode()</code> of
    <code>object</code>. The case of a <code>null</code>
    <code>object</code> is handled; zero is returned. <p/>
        
    This method is complementary to the method {@link #equal} which tests two
    objects for equality in a <code>null</code> safe manner. <p/>
        
    @param object the object for which to return the hashcode
    @return the hashcode value or <code>0</code> if <code>object</code> is
        <code>null</code>
    @aribaapi ariba
    */
    public static int hashCode(Object object) {
        return object != null ? object.hashCode() : 0;
    }
}

Related

  1. hashcode(Object obj)
  2. hashCode(Object obj)
  3. hashCode(Object obj)
  4. hashCode(Object obj)
  5. hashCode(Object object)
  6. hashCode(Object object)
  7. hashCode(Object object)
  8. hashCode(Object objects[])
  9. hashCode(Object value)