EventSorter implements Function<List<Event>, List<Event>> { @Override public List<Event> apply(List<Event> events) { return events.stream() .sorted() .collect(Collectors.toList()); }  @Override List<Event> apply(List<Event> events);  }
@Test public void testSorting() { List<Event> expected = new ArrayList<>(data); Collections.sort(expected); EventSorter sorter = new EventSorter(); List<Event> actual = sorter.apply(data); assertEquals(expected, actual); }