mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
18 lines
463 B
Java
18 lines
463 B
Java
// "Collapse loop with stream 'toArray()'" "true-preview"
|
|
package com.google.common.collect;
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Stream;
|
|
|
|
class Sets {
|
|
public static <E extends Comparable> TreeSet<E> newTreeSet() {
|
|
return new TreeSet<E>();
|
|
}
|
|
}
|
|
|
|
public class Test {
|
|
public String[] test(List<String> input) {
|
|
return input.stream().filter(Objects::nonNull).flatMap(s -> Stream.of(s, s + s)).distinct().sorted().toArray(String[]::new);
|
|
}
|
|
}
|