mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
IDEA-167942 Migrate to simplified collection factories (JEP 269): support explicit addition chain
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'List.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void testList() {
|
||||
List<Integer> list;
|
||||
list = List.of(1, 2);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Set.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
private static final Set<String> MY_SET;
|
||||
|
||||
static {
|
||||
Set<String> set;
|
||||
MY_SET = Set.of("foo", "bar", "xyz");
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'Set.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test2() {
|
||||
Set<String> set;
|
||||
set = Set.of("foo", "bar", "xyz");
|
||||
System.out.println(set);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with 'List.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void testList() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
list = Collections.unmodifi<caret>ableList(list);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with 'List.of' call" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void testList() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
List<Integer> list2 = Collections.unmodifi<caret>ableList(list);
|
||||
System.out.println(list); // mutable list is reused here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'Set.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
private static final Set<String> MY_SET;
|
||||
|
||||
static {
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("foo");
|
||||
set.add("bar");
|
||||
set.add("xyz");
|
||||
MY_SET = Collections.unmodif<caret>iableSet(set);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'Set.of' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void test2() {
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("foo");
|
||||
set.add("bar");
|
||||
set.add("xyz");
|
||||
set = Collections.unmodif<caret>iableSet(set);
|
||||
System.out.println(set);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user