mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
IDEA-187212 Suggest to use Java 10 List/Set/Map.copyOf where possible
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// "Fix all 'Immutable collection creation can be replaced with collection factory call' problems in file" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
private final List<String> myList;
|
||||
private final Map<String, String> myMap;
|
||||
private final Set<String> mySet;
|
||||
|
||||
Main(Collection<String> list, Map<? extends String, ? extends String> map,
|
||||
Set<String> set) {
|
||||
myList = List.<String>copyOf(list);
|
||||
myMap = Map.<String, String>copyOf(map);
|
||||
mySet = Set.<String>copyOf(set);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Fix all 'Immutable collection creation can be replaced with collection factory call' problems in file" "false"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
private final List<String> myList;
|
||||
private final Map<String, String> myMap;
|
||||
private final Set<String> mySet;
|
||||
|
||||
Main(Collection<String> list, Map<? extends String, ? extends String> map,
|
||||
Set<String> set) {
|
||||
myList = Collections.un<caret>modifiableList(new ArrayList<>(list));
|
||||
myMap = Collections.unmodifiableMap(new HashMap<>(map));
|
||||
mySet = Collections.unmodifiableSet(new HashSet<>(set));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Fix all 'Immutable collection creation can be replaced with collection factory call' problems in file" "true"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
private final List<String> myList;
|
||||
private final Map<String, String> myMap;
|
||||
private final Set<String> mySet;
|
||||
|
||||
Main(Collection<String> list, Map<? extends String, ? extends String> map,
|
||||
Set<String> set) {
|
||||
myList = Collections.un<caret>modifiableList(new ArrayList<>(list));
|
||||
myMap = Collections.unmodifiableMap(new HashMap<>(map));
|
||||
mySet = Collections.unmodifiableSet(new HashSet<>(set));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user