CombinedComparatorImpl implements CombinedComparator<ENTITY> { @Override public int compare(ENTITY o1, ENTITY o2) { for (final FieldComparator<? super ENTITY> comp : comparators) { final int c = comp.compare(o1, o2); if (c != 0) return c; } return 0; } CombinedComparatorImpl(
            final List<FieldComparator<? super ENTITY>> comparators); @Override Stream<FieldComparator<? super ENTITY>> stream(); @Override int size(); @Override int compare(ENTITY o1, ENTITY o2); @Override CombinedComparator<ENTITY> reversed(); @Override Comparator<ENTITY> thenComparing(Comparator<? super ENTITY> other); @Override Comparator<ENTITY> thenComparing(
            final Function<? super ENTITY, ? extends U> keyExtractor,
            final Comparator<? super U> keyComparator); @Override Comparator<ENTITY> thenComparing(Function<? super ENTITY, ? extends U> keyExtractor); @Override Comparator<ENTITY> thenComparingInt(ToIntFunction<? super ENTITY> keyExtractor); @Override Comparator<ENTITY> thenComparingLong(ToLongFunction<? super ENTITY> keyExtractor); @Override Comparator<ENTITY> thenComparingDouble(ToDoubleFunction<? super ENTITY> keyExtractor); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test void compare() throws Exception { comparatorsAndReverses().forEachOrdered(comp -> { final Comparator<Entity> mock = mockComparator( comp.getField(), comp.getNullOrder(), comp.isReversed() ); try { final List<Entity> expected = list.stream().sorted(mock).collect(toList()); final List<Entity> actual = list.stream().sorted(comp).collect(toList()); assertEquals(actual, expected, format( "Compare %s using %s", comp.getField().identifier().getColumnId(), comp )); } catch (final IllegalArgumentException ex) { throw new RuntimeException(format( "Error comparing %s using %s", comp.getField().identifier().getColumnId(), comp ), ex); } }); }