FileDocCategorySizeDatePackage
LangUtils.javaAPI DocAndroid 1.5 API2991Wed May 06 22:41:10 BST 2009org.apache.http.util

LangUtils

public final class LangUtils extends Object
A set of utility methods to help produce consistent {@link Object#equals equals} and {@link Object#hashCode hashCode} methods.
author
Oleg Kalnichevski
since
4.0

Fields Summary
public static final int
HASH_SEED
public static final int
HASH_OFFSET
Constructors Summary
private LangUtils()
Disabled default constructor.


        
      
    
Methods Summary
public static booleanequals(java.lang.Object obj1, java.lang.Object obj2)

        return obj1 == null ? obj2 == null : obj1.equals(obj2);
    
public static booleanequals(java.lang.Object[] a1, java.lang.Object[] a2)

        if (a1 == null) {
            if (a2 == null) {
                return true;
            } else {
                return false;
            }
        } else {
            if (a2 != null && a1.length == a2.length) {
                for (int i = 0; i < a1.length; i++) {
                    if (!equals(a1[i], a2[i])) {
                        return false;
                    }
                }
                return true;
            } else {
                return false;
            }
        }
    
public static inthashCode(int seed, int hashcode)

        return seed * HASH_OFFSET + hashcode;
    
public static inthashCode(int seed, boolean b)

        return hashCode(seed, b ? 1 : 0);
    
public static inthashCode(int seed, java.lang.Object obj)

        return hashCode(seed, obj != null ? obj.hashCode() : 0);