Determines whether one symbol precedes another.
@param s1 symbol 1
@param s2 symbol 2
@return true if symbol 1 precedes symbol 2
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;
  }
938190
public static boolean equalsIgnoreCase(String str1, String str2) {
        return (str1 == null || str2 == null)
                ? false
                : (str1 == str2 || lowerCaseInternal(str1).equals(lowerCaseInternal(str2)));
    }
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);
    }
  }
980303
public static boolean unsignedIntersects(ShortBuffer set1, int length1, ShortBuffer set2,
      int length2) {
    if ((0 == length1) || (0 == length2)) {
      return false;
    }
    int k1 = 0;
    int k2 = 0;

    // could be more efficient with galloping
    short s1 = set1.get(k1);
    short s2 = set2.get(k2);

    mainwhile: while (true) {
      if (toIntUnsigned(s2) < toIntUnsigned(s1)) {
        do {
          ++k2;
          if (k2 == length2) {
            break mainwhile;
          }
          s2 = set2.get(k2);
        } while (toIntUnsigned(s2) < toIntUnsigned(s1));
      }
      if (toIntUnsigned(s1) < toIntUnsigned(s2)) {
        do {
          ++k1;
          if (k1 == length1) {
            break mainwhile;
          }
          s1 = set1.get(k1);
        } while (toIntUnsigned(s1) < toIntUnsigned(s2));
      } else {
        return true;
      }
    }
    return false;
  }
1175474
private static boolean samePattern(String value1, String value2) {
        if (value1.length() == 0) {
            return value2.length() == 0;
        }
        if (value1.charAt(0) == '{') {
            return value2.length() > 0 && value2.charAt(0) == '{';
        }
        return value1.equals(value2);
    }
480406
protected boolean isSameSnakSet(Iterator<Snak> snaks1, Iterator<Snak> snaks2) {
		ArrayList<Snak> snakList1 = new ArrayList<>(5);
		while (snaks1.hasNext()) {
			snakList1.add(snaks1.next());
		}

		int snakCount2 = 0;
		while (snaks2.hasNext()) {
			snakCount2++;
			Snak snak2 = snaks2.next();
			boolean found = false;
			for (int i = 0; i < snakList1.size(); i++) {
				if (snak2.equals(snakList1.get(i))) {
					snakList1.set(i, null);
					found = true;
					break;
				}
			}
			if (!found) {
				return false;
			}
		}

		return snakCount2 == snakList1.size();
	}
1273082
public static boolean areStringsEqual(String s1, String s2) {
    return s1 != null && s1.equals(s2) || s1 == null && s2 == null;
  }
1176415
def match_sp_sep(first, second):
    
    if isinstance(first, list):
        one = [set(v.split(" ")) for v in first]
    else:
        one = [{v} for v in first.split(" ")]

    if isinstance(second, list):
        other = [set(v.split(" ")) for v in second]
    else:
        other = [{v} for v in second.split(" ")]

    # all values in one must appear in other
    if any(rt not in other for rt in one):
        return False
    return True
448842
public static <T> int compare(Stream<T> s1, Stream<T> s2)
    {
        return compare(s1, s2, null);
    }
1096877
static int earlier(int pos1, int pos2) {
        if (pos1 == Position.NOPOS)
            return pos2;
        if (pos2 == Position.NOPOS)
            return pos1;
        return (pos1 < pos2 ? pos1 : pos2);
    }
1022776
public static boolean eq(String s1, String s2, int modifier) {
        return isEqual(s1, s2, modifier);
    }
86588
private boolean tokenTextsDoNotMatch(Token token1, Token token2) {
        return !token1.getText().equals(token2.getText());
    }
115944
public static <T> int compare(IntStream s1, IntStream s2)
    {
        return compare(s1, s2, null);
    }
1025804
public static int compare(CharSequence s1, CharSequence s2)
    {
        return compare(s1, s2, Funcs::same);
    }
1298188
public static int compare( String s1, String s2)
	{
		if (s1 == null && s2 == null)
		{
			return 0;
		}
		else if (s1 == null && s2 != null)
		{
			return -1;
		}
		else if (s1 != null && s2 == null)
		{
			return 1;
		}
		else
		{
			return s1.compareTo(s2);
		}
	}
738910
public static <T> int compare(Stream<T> s1, Stream<T> s2, Comparator<T> comp)
    {
        Iterator<T> os1 = s1.iterator();
        Iterator<T> os2 = s2.iterator();
        Comparable<T> comparable = null;
        while (os1.hasNext() && os2.hasNext())
        {
            T n1 = os1.next();
            T n2 = os2.next();
            int c;
            if (comp == null)
            {
                comparable = (Comparable<T>) n1;
                c = comparable.compareTo(n2);
            }
            else
            {
                c = comp.compare(n1, n2);
            }
            if (c != 0)
            {
                return c;
            }
        }
        boolean hn1 = os1.hasNext();
        boolean hn2 = os2.hasNext();
        if (hn1 == hn2)
        {
            return 0;
        }
        if (hn1)
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
570546
protected boolean isTokenPair(AnalyzedTokenReadings[] tokens, int n, boolean before) {
    if (before) {
      if ((tokens[n-2].hasPosTagStartingWith("SUB") && tokens[n-1].hasPosTagStartingWith("PRP")
              && tokens[n].hasPosTagStartingWith("SUB"))
          || (!tokens[n-2].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n].getToken().equals("hart"))
         ) {
        return true;
      }
    } else {
      if ((tokens[n].hasPosTagStartingWith("SUB") && tokens[n+1].hasPosTagStartingWith("PRP")
              && tokens[n+2].hasPosTagStartingWith("SUB"))
          || (!tokens[n].getToken().equals("hart") && !tokens[n-1].getToken().equals("auf") && !tokens[n + 2].getToken().equals("hart"))
         ) {
        return true;
      }
    }
    return false;
  }