@Test public void testNaturalOrder() { int[] expected = {1, 2, 3, 5, 8, 13}; IntStream stream = IntStream.of(1, 2, 3, 5, 8, 13) .sorted(ComparatorCompat.<Integer>naturalOrder()); assertThat(stream.toArray(), is(expected)); }
@NotNull @SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() { return (ComparatorCompat<T>) NATURAL_ORDER; }
ComparatorCompat implements Comparator<T> { @NotNull @SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() { return (ComparatorCompat<T>) NATURAL_ORDER; } }
ComparatorCompat implements Comparator<T> { @NotNull @SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() { return (ComparatorCompat<T>) NATURAL_ORDER; } ComparatorCompat(@NotNull Comparator<? super T> comparator); }
ComparatorCompat implements Comparator<T> { @NotNull @SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() { return (ComparatorCompat<T>) NATURAL_ORDER; } ComparatorCompat(@NotNull Comparator<? super T> comparator); @NotNull @SuppressWarnings("unchecked") static ComparatorCompat<T> naturalOrder(); @NotNull @SuppressWarnings("unchecked") static ComparatorCompat<T> reverseOrder(); @NotNull static Comparator<T> reversed(@Nullable Comparator<T> comparator); @NotNull static Comparator<T> thenComparing(
            @NotNull final Comparator<? super T> c1,
            @NotNull final Comparator<? super T> c2); @NotNull static ComparatorCompat<T> comparing(
            @NotNull final Function<? super T, ? extends U> keyExtractor,
            @NotNull final Comparator<? super U> keyComparator); @NotNull static ComparatorCompat<T> comparing(
            @NotNull final Function<? super T, ? extends U> keyExtractor); @NotNull static ComparatorCompat<T> comparingInt(
            @NotNull final ToIntFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> comparingLong(
            @NotNull final ToLongFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> comparingDouble(
            @NotNull final ToDoubleFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> nullsFirst(); @NotNull static ComparatorCompat<T> nullsFirst(@Nullable Comparator<? super T> comparator); @NotNull static ComparatorCompat<T> nullsLast(); @NotNull static ComparatorCompat<T> nullsLast(@Nullable Comparator<? super T> comparator); @NotNull static ComparatorCompat<T> chain(@NotNull Comparator<T> comparator); @NotNull ComparatorCompat<T> reversed(); @NotNull ComparatorCompat<T> thenComparing(@NotNull final Comparator<? super T> other); @NotNull ComparatorCompat<T> thenComparing(
            @NotNull Function<? super T, ? extends U> keyExtractor,
            @NotNull Comparator<? super U> keyComparator); @NotNull ComparatorCompat<T> thenComparing(
            @NotNull Function<? super T, ? extends U> keyExtractor); @NotNull ComparatorCompat<T> thenComparingInt(@NotNull ToIntFunction<? super T> keyExtractor); @NotNull ComparatorCompat<T> thenComparingLong(@NotNull ToLongFunction<? super T> keyExtractor); @NotNull ComparatorCompat<T> thenComparingDouble(@NotNull ToDoubleFunction<? super T> keyExtractor); @NotNull @SuppressWarnings("unchecked") Comparator<T> comparator(); @Override int compare(T o1, T o2); }
ComparatorCompat implements Comparator<T> { @NotNull @SuppressWarnings("unchecked") public static <T extends Comparable<? super T>> ComparatorCompat<T> naturalOrder() { return (ComparatorCompat<T>) NATURAL_ORDER; } ComparatorCompat(@NotNull Comparator<? super T> comparator); @NotNull @SuppressWarnings("unchecked") static ComparatorCompat<T> naturalOrder(); @NotNull @SuppressWarnings("unchecked") static ComparatorCompat<T> reverseOrder(); @NotNull static Comparator<T> reversed(@Nullable Comparator<T> comparator); @NotNull static Comparator<T> thenComparing(
            @NotNull final Comparator<? super T> c1,
            @NotNull final Comparator<? super T> c2); @NotNull static ComparatorCompat<T> comparing(
            @NotNull final Function<? super T, ? extends U> keyExtractor,
            @NotNull final Comparator<? super U> keyComparator); @NotNull static ComparatorCompat<T> comparing(
            @NotNull final Function<? super T, ? extends U> keyExtractor); @NotNull static ComparatorCompat<T> comparingInt(
            @NotNull final ToIntFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> comparingLong(
            @NotNull final ToLongFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> comparingDouble(
            @NotNull final ToDoubleFunction<? super T> keyExtractor); @NotNull static ComparatorCompat<T> nullsFirst(); @NotNull static ComparatorCompat<T> nullsFirst(@Nullable Comparator<? super T> comparator); @NotNull static ComparatorCompat<T> nullsLast(); @NotNull static ComparatorCompat<T> nullsLast(@Nullable Comparator<? super T> comparator); @NotNull static ComparatorCompat<T> chain(@NotNull Comparator<T> comparator); @NotNull ComparatorCompat<T> reversed(); @NotNull ComparatorCompat<T> thenComparing(@NotNull final Comparator<? super T> other); @NotNull ComparatorCompat<T> thenComparing(
            @NotNull Function<? super T, ? extends U> keyExtractor,
            @NotNull Comparator<? super U> keyComparator); @NotNull ComparatorCompat<T> thenComparing(
            @NotNull Function<? super T, ? extends U> keyExtractor); @NotNull ComparatorCompat<T> thenComparingInt(@NotNull ToIntFunction<? super T> keyExtractor); @NotNull ComparatorCompat<T> thenComparingLong(@NotNull ToLongFunction<? super T> keyExtractor); @NotNull ComparatorCompat<T> thenComparingDouble(@NotNull ToDoubleFunction<? super T> keyExtractor); @NotNull @SuppressWarnings("unchecked") Comparator<T> comparator(); @Override int compare(T o1, T o2);  }