Safe equals.

@param s1            the s 1
@param s2            the s 2
@param caseSensitive the case sensitive
@return the boolean
187586
public static boolean safeEquals(String s1, String s2, boolean caseSensitive) {
      if (s1 == s2) {
         return true;
      } else if (s1 == null || s2 == null) {
         return false;
      } else if (caseSensitive) {
         return s1.equals(s2);
      }
      return s1.equalsIgnoreCase(s2);
   }
14131
public static <T> boolean equalsE(T a, T b) {
        if (a == null && b == null) {
            return true;
        }
        if (a != null && b == null) {
            return false;
        }
        if (a == null) {
            return false;
        }
        return a.equals(b);
    }
574891
private String getName(String s1, String s2) {
        if (s1 == null || "".equals(s1)) return s2;
        else return s1;
    }
901341
public boolean equal(final Object o1,
                         Object o2) {
        if ( o1 == o2 ) {
            return true;
            
        }
        // o1 is a FactHandle, so just check their id's are the same
        if ( o1 instanceof FactHandle ) {
            return ((InternalFactHandle)o1).getId() == ((InternalFactHandle)o2).getId() ;
        }

        // o1 is an object, so unwrap o2 for comparison
        final InternalFactHandle handle = ((InternalFactHandle) o2);
        o2 = handle.getObject();
        return o1 == o2 || o2.equals( o1 );
    }
1160924
private boolean isMatchingString(String value1, String value2) {
        
        boolean valuesMatch = true;
        
        if (value1 == null) {
            if (value2 != null) {
                valuesMatch = false;
            }
        } else { 
            valuesMatch = value1.equals(value2);
        }
        
        return valuesMatch;
    }
1024240
public boolean areEquals(String str1, String str2) {

		return (str1 == null && str2 == null || str1 != null && str2 != null && str1.equals(str2));
	}
791699
public static <E> Set<E> symmetricDiff(Set<E> s1, Set<E> s2) {
    Set<E> s = new HashSet<E>();
    for (E o : s1) {
      if (!s2.contains(o)) {
        s.add(o);
      }
    }
    for (E o : s2) {
      if (!s1.contains(o)) {
        s.add(o);
      }
    }
    return s;
  }
1084201
public static boolean isEquals( String s1, String s2)
	{
		return s1 == null ? s2 == null : s1.equals(s2);
	}
7850
public static <E> Set<E> difference(Set<? extends E> s1, Set<? extends E> s2) {
      Set<E> copy1 = new HashSet<>(s1);
      copy1.removeAll(new HashSet<>(s2));
      return copy1;
   }
131310
final static boolean valEquals(final Object o1, final Object o2) {
    return (o1 == null ? o2 == null : o1.equals(o2));
  }
180103
@Override
  public int compare(String s1, String s2) {
    if (s1 == s2) { // NOSONAR false-positive: Compare Objects With Equals
      return 0;
    }
    int h1 = s1.hashCode();
    int h2 = s2.hashCode();
    if (h1 < h2) {
      return -1;
    } else if (h1 > h2) {
      return 1;
    } else {
      return s1.compareTo(s2);
    }
  }
356328
boolean precedes(final String s1, final String s2) {
    String symbol1 = s1.toLowerCase(Locale.ENGLISH);
    String symbol2 = s2.toLowerCase(Locale.ENGLISH);

    if (!precedenceMap.keySet().contains(symbol1)) {
      return false;
    }

    if (!precedenceMap.keySet().contains(symbol2)) {
      return false;
    }

    int index1 = ((Integer) precedenceMap.get(symbol1)).intValue();
    int index2 = ((Integer) precedenceMap.get(symbol2)).intValue();

    boolean precedesResult = (index1 < index2);

    return precedesResult;
  }
935351
public static boolean containsIgnoreCase(Collection<String> c, String s) {
    for (String squote: c) {
      if (squote.equalsIgnoreCase(s))
        return true;
    }
    return false;
  }
367043
public static boolean isEqualOrNull( Map s1,
                                         Map s2 ) {
        if ( s1 == null
                && s2 == null ) {
            return true;
        } else if ( s1 != null
                && s2 != null
                && s1.size() == s2.size() ) {
            return true;
        }
        return false;
    }
1339910
public static Pair<String,String> pair (final String s1, final String s2)
        {        
        if (StringUtils.isBlank(s1))
            {
            LOG.warn("Blank first arg");
            }
        if (StringUtils.isBlank(s2))
            {
            LOG.warn("Blank second arg for: "+s1);
            }
        return new PairImpl<String,String> (s1, s2);
        }
222131
public final double similarity(final String s1, final String s2) {
        int[] mtp = matches(s1, s2);
        float m = mtp[0];
        if (m == 0) {
            return 0f;
        }
        double j = ((m / s1.length() + m / s2.length() + (m - mtp[1]) / m))
                / THREE;
        double jw = j;

        if (j > getThreshold()) {
            jw = j + Math.min(JW_COEF, 1.0 / mtp[THREE]) * mtp[2] * (1 - j);
        }
        return jw;
    }
1091910
private boolean tagEquals(String tag1, String tag2) {
        if (caseSensitive) {
            return tag1.equals(tag2);
        }

        return tag1.equalsIgnoreCase(tag2);
    }