java iterable to list

Solutions on MaxInterview for java iterable to list by the best coders in the world

showing results for - "java iterable to list"
Emilia
14 Oct 2019
1@Test
2public void whenConvertIterableToListUsingJava8_thenSuccess() {
3    List<String> result = new ArrayList<String>();
4    iterable.forEach(result::add);
5
6    assertThat(result, contains("john", "tom", "jane"));
7}