FileDocCategorySizeDatePackage
ObjectUtil.javaAPI DocGlassfish v2 API3181Fri May 04 22:31:06 BST 2007com.sun.appserv.management.util.misc

ObjectUtil

public final class ObjectUtil extends Object
Provides a variety of useful utilities for computing hashCode().

Fields Summary
Constructors Summary
private ObjectUtil()

		// disallow instantiation
	
Methods Summary
public static booleanequals(java.lang.Object s1, java.lang.Object s2)

        boolean equals  = false;
        
        if ( s1 == s2 )
        {
            equals  = true;
        }
        else if ( s1 != null )
        {
            equals  = s1.equals( s2 );
        }
        else
        {
            // s1 is null and s2 isn't
            equals  = false;
        }
        
        return equals;
    
public static inthashCode(boolean value)

	    return value ? 1 : 0;
	
public static inthashCode(java.lang.Object items)

	    int result  = 0;
	    
	    for( final Object item : items )
	    {
	        result ^= hashCode( item );
	    }
	    return result;
	
public static inthashCode(java.lang.Object o)

	    return o == null ? 0 : o.hashCode();
	
public static inthashCode(long value)

	    return (int)value ^ (int)(value >> 32);
	
public static inthashCode(double value)

	    return new Double( value ).hashCode();