ConfigurationHelper { public static <T extends Transformer> Map<Boolean, List<T>> createTransformers(List<T> transform) { return transform.stream() .collect(partitioningBy(General::isGeneral)); }  static List<T> sort(Collection<T> collection); static Map<Boolean, List<T>> createTransformers(List<T> transform);  }
@Test public void testCreateTransformers() throws Exception { List<Reader> readers = Arrays.asList(new FirstReader(), new GeneralReader(), new SecondReader(), new GeneralReader()); Map<Boolean, List<Reader>> transformers = createTransformers(readers); assertEquals(2, transformers.get(Boolean.TRUE).size()); assertEquals(2, transformers.get(Boolean.FALSE).size()); List<Reader> generalReaders = transformers.get(Boolean.TRUE); assertEquals(MediaType.of("reader/GENERAL"), generalReaders.get(0).getMediaType()); assertEquals(MediaType.of("reader/GENERAL"), generalReaders.get(1).getMediaType()); List<Reader> commonReaders = transformers.get(Boolean.FALSE); assertEquals(MediaType.of("reader/FIRST"), commonReaders.get(0).getMediaType()); assertEquals(MediaType.of("reader/SECOND"), commonReaders.get(1).getMediaType()); }