ConfigurationHelper { public static <T extends Ordered> List<T> sort(Collection<T> collection) { Comparator<T> aspectComparator = (e1, e2) -> Integer.compare(e1.getOrder(), e2.getOrder()); return collection.stream() .sorted(aspectComparator) .collect(toList()); }  static List<T> sort(Collection<T> collection); static Map<Boolean, List<T>> createTransformers(List<T> transform);  }
@Test public void testSort() throws Exception { List<Interceptor> interceptors = Arrays.asList(new FirstInterceptor(), new ThirdInterceptor(), new SecondInterceptor()); List<Interceptor> sorted = new ArrayList<>(sort(interceptors)); assertEquals(FirstInterceptor.ORDER, sorted.get(0).getOrder()); assertEquals(SecondInterceptor.ORDER, sorted.get(1).getOrder()); assertEquals(ThirdInterceptor.ORDER, sorted.get(2).getOrder()); }