Answers for "list java iterable|?"

2

java Iterable to list

@Test
public void whenConvertIterableToListUsingJava8_thenSuccess() {
    List<String> result = new ArrayList<String>();
    iterable.forEach(result::add);

    assertThat(result, contains("john", "tom", "jane"));
}
Posted by: Guest on January-13-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language