mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 20:07:01 +07:00
29 lines
701 B
Java
29 lines
701 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.List;
|
|
import java.util.function.Consumer;
|
|
|
|
import static java.util.Arrays.asList;
|
|
|
|
public class Main {
|
|
public static long test(List<String> list) {
|
|
long count = 0;
|
|
for (String l : list) {
|
|
if (l != null) {
|
|
(new Consumer<String>() {
|
|
String lst = "hello";
|
|
|
|
public void accept(String lst) {
|
|
System.out.println(this.lst + lst);
|
|
}
|
|
}).accept(l);
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(test(asList("a", "b", "c")));
|
|
}
|
|
} |