Returns the elements that are present in s1 but which are not present
in s2, without changing the contents of neither s1, nor s2.

@param s1 first set
@param s2 second set
@param <E> type of objects in Set
@return the elements in s1 that are not in 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;
   }
1258951
public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) {
		final List<E> result = new ArrayList<E>(list1.size() + list2.size());
		result.addAll(list1);
		result.addAll(list2);
		return result;
	}
426272
public static Type getMoreSpecificType(final Type one, final Type two) {
        return isMoreSpecific(one, two) ? one : two;
    }
919598
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
            else return o1.candidatePreferred.compareTo(o2.candidatePreferred);
        }
        return -1;
    }
977105
public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2)
	{
		if (node1 == null || node2 == null || node1.getOpcode() != node2.getOpcode())
			return false;

		switch (node2.getType())
		{
			case VAR_INSN:
				return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
			case TYPE_INSN:
				return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
			case FIELD_INSN:
				return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
			case METHOD_INSN:
				return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
			case LDC_INSN:
				return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
			case IINC_INSN:
				return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
			case INT_INSN:
				return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
			default:
				return true;
		}
	}
344567
public static boolean compareStrings(String s1, String s2) {
        if (s1 == s2)
            return true;
        if (s1 != null && s2 != null && s1.equals(s2))
            return true;
        return false;
    }
1161000
public static boolean areEqual(String s1, String s2) {
        return (s1 == null) ? s2 == null : s1.equals(s2);
    }
1084201
public static boolean isEquals( String s1, String s2)
	{
		return s1 == null ? s2 == null : s1.equals(s2);
	}
170712
public boolean join(Set<T> s1, Set<T> s2) {
	return s1.addAll(s2);
    }
1335260
function(value1, value2) {
		// check primary direction
		if (value1 === value2) {
			return true;
		}
		var Type1 = set.getType(value1),
			Type2 = set.getType(value2);
		var forwardComparators = set.getComparisons(Type1, Type2);
		if (forwardComparators) {
			// A set is a subset, if it intersects with the set, and it has nothing
			// outside the other set.
			var intersection = get.intersection(forwardComparators, value1, value2);
			// [a, b] \ [a, b, c]
			var difference = get.difference(forwardComparators, value1, value2);
			// they intersect, but value2 has nothing value1 outside value2
			if (intersection === set.UNKNOWABLE || difference === set.UNKNOWABLE) {
				// {sort: "a", page: 0-2} E {sort: "b", page: 2-3}
				return undefined;
			} else if (intersection !== set.EMPTY && difference === set.EMPTY) {
				return true;
			} else {
				return false;
			}
		} else {
			throw new Error("Unable to perform subset comparison between " + Type1.name + " and " + Type2.name);
		}
	}
693350
public static int compareToIgnoreCaseCarefulEquals(String S1, String S2) {
		int diff=S1.compareToIgnoreCase(S2);
		if(diff==0) diff=S1.compareTo(S2);
		return diff;
	}
1101456
public static <E> Set<E> difference(Set<E> first, Set<E> second) {
        if (first == null || first.size() == 0) {
            return new HashSet<>();
        }

        if (second == null || second.size() == 0) {
            return first;
        }

        Set<E> difference = new HashSet<>(first);
        difference.removeAll(second);
        return difference;
    }
639624
@Override
    public Pair<Optional<E1>, Optional<E2>> next() {
        return Pair.of(former.next(), latter.next());
    }
667666
public static <E> Set<E> intersection(Set<E> first, Set<E> second) {
        if (first == null || second == null) {
            return EMPTY_SET;
        }

        Set<E> intersection = new HashSet<>();

        for (E e : first) {
            if (second.contains(e)) {
                intersection.add(e);
            }
        }
        return intersection;
    }
489790
public static boolean isNotEqual(String s1, String s2, int modifier) {
        return !isEqual(s1, s2, modifier);
    }
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);
    }
  }
87004
public static <T> T noNullElseGet(@NonNull Supplier<T> s1, @NonNull Supplier<T> s2) {
        T t1 = s1.get();
        if (t1 != null) {
            return t1;
        }
        return s2.get();
    }