mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
MigrateToStreamFix: explicit formatting removed (as formatted anyways automatically)
This commit is contained in:
@@ -5,12 +5,12 @@ import java.util.stream.Collectors;
|
||||
// Java 8 language level used: no toUnmodifiable suggestions
|
||||
class Test {
|
||||
List<String> test(String[] list) {
|
||||
List<String> result = Arrays.stream(list).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(LinkedList::new));
|
||||
List<String> result = Arrays.stream(list).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(LinkedList::new));
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
Collection<String> test2(String[] list) {
|
||||
Set<String> result = Arrays.stream(list).filter(s -> !s.isEmpty()).collect(Collectors.toSet());
|
||||
Set<String> result = Arrays.stream(list).filter(s -> !s.isEmpty()).collect(Collectors.toSet());
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class Test {
|
||||
}
|
||||
|
||||
Set<String> test4(String[] array) {
|
||||
Set<String> result = Arrays.stream(array).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(TreeSet::new));
|
||||
Set<String> result = Arrays.stream(array).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(TreeSet::new));
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ class Test {
|
||||
}
|
||||
|
||||
Set<String> test4(String[] array) {
|
||||
Set<String> result = Arrays.stream(array).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(TreeSet::new));
|
||||
Set<String> result = Arrays.stream(array).filter(s -> !s.isEmpty()).collect(Collectors.toCollection(TreeSet::new));
|
||||
// toUnmodifiableSet will not preserve order; not suggested here
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class Test {
|
||||
}
|
||||
|
||||
Map<String, Integer> map1(List<String> input) {
|
||||
Map<String, Integer> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toMap(s -> s, String::length, (a, b) -> b, TreeMap::new));
|
||||
Map<String, Integer> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toMap(s -> s, String::length, (a, b) -> b, TreeMap::new));
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user