code: public static int compareTo(final boolean caseSensitive, final CharSequence text1, final CharSequence text2) {
  
          if (text1 == null) {
              throw new IllegalArgumentException("First text being compared cannot be null");
          }
          if (text2 == null) {
              throw new IllegalArgumentException("Second text being compared cannot be null");
          }
  
          if (text1 instanceof String && text2 instanceof String) {
              return (caseSensitive ? ((String)text1).compareTo((String)text2) : ((String)text1).compareToIgnoreCase((String)text2));
          }
  
          return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length());
  
      }
docs: <p>
  Compares two texts lexicographically.
  </p>
  <p>
  The comparison is based on the Unicode value of each character in the CharSequences. The character sequence
  represented by the first text object is compared lexicographically to the character sequence represented
  by the second text.
  </p>
  <p>
  The result is a negative integer if the first text lexicographically precedes the second text. The
  result is a positive integer if the first text lexicographically follows the second text. The result
  is zero if the texts are equal.
  </p>
  <p>
  This method works in a way equivalent to that of the {@link java.lang.String#compareTo(String)}
  and {@link java.lang.String#compareToIgnoreCase(String)} methods.
  </p>
  
  @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
  @param text1 the first text to be compared.
  @param text2 the second text to be compared.
  @return the value {@code 0} if both texts are equal; a value less than {@code 0} if the first text
  is lexicographically less than the second text; and a value greater than {@code 0} if the
  first text is lexicographically greater than the second text.