Answers for "cast iterable to list java"

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

java lambda list of objects cast

collection.stream()
    .filter(obj -> obj instanceof ScheduleIntervalContainer)
    .map(obj -> (ScheduleIntervalContainer) obj)
Posted by: Guest on April-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language