ApiUtils { static <T> List<T> list(Function<Integer, List<T>> action) { return listImpl(1, action, new ArrayList<>()); }    }
@Test public void testList() { List<String> result = list(pn -> { if (pn == 1) { return Collections.singletonList("test"); } return Collections.emptyList(); }); assertThat(result, contains("test")); }