@Override
    public <U> Comparator<ENTITY> thenComparing(
            final Function<? super ENTITY, ? extends U> keyExtractor,
            final Comparator<? super U> keyComparator) {

        if (keyExtractor instanceof Getter) {
            @SuppressWarnings("unchecked")
            final Getter<ENTITY> getter = (Getter<ENTITY>) keyExtractor;
            final Optional<Comparator<ENTITY>> result = then(getter);
            if (result.isPresent()) {
                return result.get();
            }
        }

        return (a, b) -> {
            final int c = compare(a, b);
            if (c == 0) {
                return keyComparator.compare(
                    keyExtractor.apply(a),
                    keyExtractor.apply(b)
                );
            } else return c;
        };
    }
Default implementation of the {@link CombinedComparator}-interface.

@author Emil Forslund
@since  3.0.11
runtime-parent/runtime-field/src/main/java/com/speedment/runtime/field/internal/comparator/CombinedComparatorImpl.java