public TableSelectionModel() { registerRpc(new ShiftSelectRpc() { @Override public void selectRange(int start, int length) { if (length == 0) { return; } BinaryOperator<SerializableComparator<T>> operator = (comparator1, comparator2) -> { /* * thenComparing is defined to return a serializable * comparator as long as both original comparators are also * serializable */ return comparator1.thenComparing(comparator2)::compare; }; Comparator<T> inMemorySorting = getParent().getSortOrder().stream() .map(order -> order.getSorted().getComparator(order.getDirection())) .reduce((x, y) -> 0, operator); List<QuerySortOrder> sortProperties = new ArrayList<>(); getParent().getSortOrder().stream().map(order -> order.getSorted().getSortOrder(order.getDirection())) .forEach(s -> s.forEach(sortProperties::add)); getParent().getDataProvider().fetch(new Query<>(start, length, sortProperties, inMemorySorting, null)); } }); }