public static <T> AggregateOperation1<T, ArrayList<T>, List<T>> sorting(
            @Nonnull ComparatorEx<? super T> comparator
    ) {
        checkSerializable(comparator, "comparator");
        return AggregateOperation
                .withCreate(ArrayList<T>::new)
                .<T>andAccumulate(ArrayList::add)
                .andCombine(ArrayList::addAll)
                .andExport(list -> {
                    // sorting the accumulator doesn't harm - will make the next sort an easier job
                    list.sort(comparator);
                    return (List<T>) new ArrayList<>(list);
                })
                .andFinish(list -> {
                    list.sort(comparator);
                    return list;
                });
    }
@Test
    public void when_sorting() {
        validateOpWithoutDeduct(
                sorting(naturalOrder()),
                identity(),
                2,
                1,
                singletonList(2),
                asList(2, 1),
                asList(1, 2)
        );
    }