mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 20:07:01 +07:00
Fixes IDEA-179303 Suggest replacing Collectors.toList()/toSet() + collection constructor with Collectors.toCollection
11 lines
359 B
Java
11 lines
359 B
Java
// "Fuse 'toArray' into the Stream API chain" "true"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
|
|
public class Test {
|
|
public String[] testToArray(String[] args) {
|
|
Set<String> set = Arrays.stream(args).co<caret>llect(Collectors.toCollection(TreeSet::new));
|
|
return set.toArray(new String[set.size()]);
|
|
}
|
|
} |