Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.cantaa.util;

Hans Lesmeister
 public class EqualsUtil {
    public static boolean equals(Object objectObject other) {
        return equals(objectotherfalse);

Checks equality

object 1st object to compare
other 2nd object to compare
ignoreCase if true and both objects are string then they are compared with equalsIgnoreCase. Default is false
true if:
  • Both are null
  • or both are Identifiable and both Id's are equal
  • or standard equals() returns true
    public static boolean equals(Object objectObject otherboolean ignoreCase) {
        if ((object == null) && (other == null)) {
            return true;
        if ((object == null) || (other == null)) {
            return false;
        if ((object instanceof Identifiable) && (other instanceof Identifiable)) {
            return equals(((Identifiableobject).getId(), ((Identifiableother).getId());
        if (ignoreCase && (object instanceof String) && (other instanceof String)) {
            return ((Stringobject).equalsIgnoreCase((Stringother);
        return object.equals(other);
New to GrepCode? Check out our FAQ X