mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-02 11:18:16 +07:00
16 lines
415 B
Java
16 lines
415 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.*;
|
|
import java.util.function.*;
|
|
|
|
public class Main {
|
|
private static <A> A[] toArraySkippingNulls(List<?> list, IntFunction<A[]> generator) {
|
|
List<Object> result = new ArrayList<>();
|
|
for (Object o : list) {
|
|
if (o != null) {
|
|
result.add(o);
|
|
}
|
|
}
|
|
return result.toArray(generator.apply(0));
|
|
}
|
|
} |