code: 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);
     }
docs: Safe equals.
  
  @param s1            the s 1
  @param s2            the s 2
  @param caseSensitive the case sensitive
  @return the boolean