Answers for "iterable to list"

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
0

iterable to list

List<String> result = 
  StreamSupport.stream(iterable.spliterator(), false)
    .collect(Collectors.toList());
Posted by: Guest on July-05-2021
0

convert iterator to list python

list(your_iterator)
Posted by: Guest on May-11-2021

Browse Popular Code Answers by Language