/** * Check lists for equality (sensitive to order) * * @param set1 list to compare * @param set2 list to compare * @return true if the lists have the same content, false otherwise. */ public static int compareLists(List<? extends OWLObject> set1, List<? extends OWLObject> set2) { return compareIterators(set1.iterator(), set2.iterator()); }
/** * Check lists for equality (sensitive to order) * * @param set1 list to compare * @param set2 list to compare * @return true if the lists have the same content, false otherwise. */ public static int compareLists(List<? extends OWLObject> set1, List<? extends OWLObject> set2) { return compareIterators(set1.iterator(), set2.iterator()); }
/** * Check lists for equality (sensitive to order) * * @param set1 list to compare * @param set2 list to compare * @return true if the lists have the same content, false otherwise. */ public static int compareLists(List<? extends OWLObject> set1, List<? extends OWLObject> set2) { return compareIterators(set1.iterator(), set2.iterator()); }
/** * Compare streams through iterators (sensitive to order) * * @param set1 stream to compare * @param set2 stream to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareStreams(Stream<?> set1, Stream<?> set2) { return compareIterators(set1.sorted().iterator(), set2.sorted().iterator()); }
/** * Compare streams through iterators (sensitive to order) * * @param set1 stream to compare * @param set2 stream to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareStreams(Stream<?> set1, Stream<?> set2) { return compareIterators(set1.sorted().iterator(), set2.sorted().iterator()); }
/** * Compare streams through iterators (sensitive to order) * * @param set1 stream to compare * @param set2 stream to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareStreams(Stream<?> set1, Stream<?> set2) { return compareIterators(set1.sorted().iterator(), set2.sorted().iterator()); }
/** * @param set1 collection to compare * @param set2 collection to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareCollections(Collection<? extends OWLObject> set1, Collection<? extends OWLObject> set2) { SortedSet<? extends OWLObject> ss1; if (set1 instanceof SortedSet) { ss1 = (SortedSet<? extends OWLObject>) set1; } else { ss1 = new TreeSet<>(set1); } SortedSet<? extends OWLObject> ss2; if (set2 instanceof SortedSet) { ss2 = (SortedSet<? extends OWLObject>) set2; } else { ss2 = new TreeSet<>(set2); } return compareIterators(ss1.iterator(), ss2.iterator()); }
/** * @param set1 collection to compare * @param set2 collection to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareCollections(Collection<? extends OWLObject> set1, Collection<? extends OWLObject> set2) { SortedSet<? extends OWLObject> ss1; if (set1 instanceof SortedSet) { ss1 = (SortedSet<? extends OWLObject>) set1; } else { ss1 = new TreeSet<>(set1); } SortedSet<? extends OWLObject> ss2; if (set2 instanceof SortedSet) { ss2 = (SortedSet<? extends OWLObject>) set2; } else { ss2 = new TreeSet<>(set2); } return compareIterators(ss1.iterator(), ss2.iterator()); }
/** * @param set1 collection to compare * @param set2 collection to compare * @return negative value if set1 comes before set2, positive value if set2 comes before set1, 0 * if the two sets are equal or incomparable. */ public static int compareCollections(Collection<? extends OWLObject> set1, Collection<? extends OWLObject> set2) { SortedSet<? extends OWLObject> ss1; if (set1 instanceof SortedSet) { ss1 = (SortedSet<? extends OWLObject>) set1; } else { ss1 = new TreeSet<>(set1); } SortedSet<? extends OWLObject> ss2; if (set2 instanceof SortedSet) { ss2 = (SortedSet<? extends OWLObject>) set2; } else { ss2 = new TreeSet<>(set2); } return compareIterators(ss1.iterator(), ss2.iterator()); }
int diff; if (o1 instanceof Stream && o2 instanceof Stream) { diff = compareIterators(((Stream<?>) o1).iterator(), ((Stream<?>) o2).iterator()); } else if (o1 instanceof Collection && o2 instanceof Collection) { diff = compareIterators(((Collection<?>) o1).iterator(), ((Collection<?>) o2).iterator()); } else if (o1 instanceof Comparable && o2 instanceof Comparable) {
int diff; if (o1 instanceof Stream && o2 instanceof Stream) { diff = compareIterators(((Stream<?>) o1).iterator(), ((Stream<?>) o2).iterator()); } else if (o1 instanceof Collection && o2 instanceof Collection) { diff = compareIterators(((Collection<?>) o1).iterator(), ((Collection<?>) o2).iterator()); } else if (o1 instanceof Comparable && o2 instanceof Comparable) {
int diff; if (o1 instanceof Stream && o2 instanceof Stream) { diff = compareIterators(((Stream<?>) o1).iterator(), ((Stream<?>) o2).iterator()); } else if (o1 instanceof Collection && o2 instanceof Collection) { diff = compareIterators(((Collection<?>) o1).iterator(), ((Collection<?>) o2).iterator()); } else if (o1 instanceof Comparable && o2 instanceof Comparable) {
@Override public int compareTo(@Nullable OWLObject o) { checkNotNull(o); assert o != null; int diff = Integer.compare(typeIndex(), o.typeIndex()); if (diff != 0) { return diff; } return compareIterators(components().iterator(), o.components().iterator()); }
@Override public int compareTo(@Nullable OWLObject o) { checkNotNull(o); assert o != null; int diff = Integer.compare(typeIndex(), o.typeIndex()); if (diff != 0) { return diff; } return compareIterators(components().iterator(), o.components().iterator()); }
@Override public int compareTo(@Nullable OWLObject o) { checkNotNull(o); assert o != null; int diff = Integer.compare(typeIndex(), o.typeIndex()); if (diff != 0) { return diff; } return compareIterators(components().iterator(), o.components().iterator()); }
@Override public int compareTo(@Nullable OWLObject o) { checkNotNull(o); assert o != null; int diff = Integer.compare(typeIndex(), o.typeIndex()); if (diff != 0) { return diff; } return compareIterators(components().iterator(), o.components().iterator()); }