MessageStoreUtils { public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>> List<M> buildAll(Collection<B> builders) { if (builders == null) { return null; } return builders.stream() .map(PMessageBuilder::build) .collect(Collectors.toList()); }  static List<M> buildAll(Collection<B> builders); @SuppressWarnings("unchecked") static List<B> mutateAll(Collection<M> messages); static M buildIfNotNull(B builder); @SuppressWarnings("unchecked") static B mutateIfNotNull(M message);  }
@Test public void testBuildAll() { assertThat((List) buildAll(null), is(nullValue())); }