mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
20 lines
496 B
Java
20 lines
496 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
package com.google.common.collect;
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.IntStream;
|
|
|
|
class Lists {
|
|
public static <E> ArrayList<E> newArrayList() {
|
|
return new ArrayList<E>();
|
|
}
|
|
}
|
|
|
|
public class Test {
|
|
public void test() {
|
|
List<String> list = IntStream.range(0, 10).filter(i -> i % 2 == 0).mapToObj(String::valueOf).collect(Collectors.toList());
|
|
System.out.println(list);
|
|
}
|
|
}
|