java.lang.Object
dev.mccue.guava.base.Objects
Helper functions that can operate on any
Object.
See the Guava User Guide on writing Object
methods with Objects.
- Since:
- 2.0
- Author:
- Laurence Gonsalves
-
Method Summary
-
Method Details
-
equal
Determines whether two possibly-null objects are equal. Returns:trueifaandbare both null.trueifaandbare both non-null and they are equal according toObject#equals(Object).falsein all other situations.
This assumes that any non-null objects passed to this function conform to the
equals()contract.Java 7+ users: This method should be treated as deprecated; use
java.util.Objects#equalsinstead. -
hashCode
Generates a hash code for multiple values. The hash code is generated by callingArrays#hashCode(Object[]). Note that array arguments to this method, with the exception of a single Object array, do not get any special handling; their hash codes are based on identity and not contents.This is useful for implementing
Object#hashCode(). For example, in an object that has three properties,x,y, andz, one could write:public int hashCode() { return Objects.hashCode(getX(), getY(), getZ()); }Warning: When a single object is supplied, the returned hash code does not equal the hash code of that object.
Java 7+ users: This method should be treated as deprecated; use
java.util.Objects#hashinstead.
-