📜  java Iterable to list - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:25.258000             🧑  作者: Mango

代码示例1
@Test
public void whenConvertIterableToListUsingJava8_thenSuccess() {
    List result = new ArrayList();
    iterable.forEach(result::add);

    assertThat(result, contains("john", "tom", "jane"));
}