@Override public boolean equals(Object object) { return equalByComparison(this, object); }
@Override public boolean equals(Object other) { return equalByToString(this, other); }
/** * Return true if {@code reference} and {@code object} are not null, the exact same runtime type, and {@code reference.compareTo(object) == 0} * * @throws NullPointerException * If {@code reference} is {@code null} */ public static <T extends Comparable<? super T>> boolean equalByComparison(T reference, Object object) { if (notEqual(reference, object)) { return false; } else { // notEqual() guarantees that reference and object are the exact same runtime type @SuppressWarnings("unchecked") T other = (T) object; return reference.compareTo(other) == 0; } }
@Override public boolean equals(Object other) { return equal(this, other); }
@Override public boolean equals(Object object) { return ObjectUtils.equalsByToString(this, object); }
@Override public boolean equals(Object object) { // They are the same object if (this == object) { return true; } // Make sure object isn't null and is a Permission object if (ObjectUtils.notEqual(this, object)) { return false; } // Cast to a Permission object Permission a = this; Permission b = (Permission) object; // If they both have the exact same list of CIDR notations, they are equal // This only works because Builder.build() sorts the CIDR notation list return Objects.equal(a.port, b.port) && Objects.equal(a.protocol, b.protocol) && equalElements(a.cidrNotations, b.cidrNotations); }
if (notEqual(reference, other)) { return false; // Don't bother comparing the toString() methods } else {
@Override public boolean equals(Object object) { return equalByComparison(this, object); }
@Override public boolean equals(Object object) { return equalByToString(this, object); }
/** * @deprecated Use equalByToString() instead */ @Deprecated public static boolean equalsByToString(Object reference, Object other) { return equalByToString(reference, other); }