@SuppressWarnings("unchecked")
@Test
public void toSortedList() {

    TestSubscriber<List<Integer>> ts = new TestSubscriber<List<Integer>>();
    Flowable.fromArray(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
    .parallel()
    .toSortedList(Functions.naturalComparator())
    .subscribe(ts);
    ts.assertResult(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
}