mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java: Intention that wraps list/set/map with Collections.unmodifiableList/Set/Map (IDEA-93154)
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable list" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class C {
|
||||
List<String> test() {
|
||||
List<String> result = new ArrayList<>();
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
Map<String, Integer> test() {
|
||||
var result = new HashMap<>();
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable set" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
class C {
|
||||
Set<String> test() {
|
||||
Set<String> result = new HashSet<>();
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.Collections;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class C {
|
||||
SortedMap<String, Integer> test() {
|
||||
SortedMap<String, Integer> result = new TreeMap<>();
|
||||
return Collections.unmodifiableSortedMap(result);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Wrap with unmodifiable set" "true"
|
||||
import java.util.*;
|
||||
|
||||
class C {
|
||||
Set<String> test() {
|
||||
SortedSet<String> result = new TreeSet<>();
|
||||
return Collections.unmodifiableSortedSet(result);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable list" "true"
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class C {
|
||||
List<String> test() {
|
||||
List<String> result = new ArrayList<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
Map<String, Integer> test() {
|
||||
var result = new HashMap<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable set" "true"
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
class C {
|
||||
Set<String> test() {
|
||||
Set<String> result = new HashSet<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap with unmodifiable map" "true"
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class C {
|
||||
SortedMap<String, Integer> test() {
|
||||
SortedMap<String, Integer> result = new TreeMap<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Wrap with unmodifiable set" "true"
|
||||
import java.util.*;
|
||||
|
||||
class C {
|
||||
Set<String> test() {
|
||||
SortedSet<String> result = new TreeSet<>();
|
||||
return <caret>result;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable list" "false"
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class C {
|
||||
List<String> test() {
|
||||
List<String> result = new ArrayList<>();
|
||||
return Collections.<caret>unmodifiableList(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable list" "false"
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class C {
|
||||
List<String> test() {
|
||||
List<String> result = new ArrayList<>();
|
||||
return Collections.unmodifiableList(<caret>result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
Map<String, Integer> test() {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
return Collections.unmodifiab<caret>leMap(result);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap with unmodifiable map" "false"
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class C {
|
||||
Map<String, Integer> test() {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
return Collections.unmodifiableMap((res<caret>ult));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Wrap with unmodifiable set" "false"
|
||||
import java.util.*;
|
||||
|
||||
class C {
|
||||
Set<String> test() {
|
||||
SortedSet<String> result = new TreeSet<>();
|
||||
return Collections.unmodifiableSor<caret>tedSet(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user