mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-178788 Suggestion code replace from list iteration to List.removeAll
This commit is contained in:
+1
-2
@@ -26,8 +26,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class JdkBulkMethodInfoProvider implements BulkMethodInfoProvider {
|
||||
private static BulkMethodInfo[] INFOS = {
|
||||
new BulkMethodInfo(CommonClassNames.JAVA_UTIL_COLLECTION, "add", "addAll"),
|
||||
new BulkMethodInfo(CommonClassNames.JAVA_UTIL_LIST, "remove", "removeAll")
|
||||
new BulkMethodInfo(CommonClassNames.JAVA_UTIL_COLLECTION, "add", "addAll")
|
||||
};
|
||||
|
||||
@NotNull
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toAdd){
|
||||
persons.addAll(toAdd);
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// "Replace iteration with bulk 'List.removeAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toRemove){
|
||||
persons.removeAll(toRemove);
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// "Replace iteration with bulk 'List.removeAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toRemove){
|
||||
persons.removeAll(toRemove);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toAdd){
|
||||
Iterator<Person> it = toAdd.iterator();
|
||||
while (it.hasNext()) {
|
||||
Person person = it.next();
|
||||
persons<caret>.add(person);
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// "Replace iteration with bulk 'List.removeAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toRemove){
|
||||
for (Iterator<Person> it = toRemove.iterator(); it.hasNext(); )
|
||||
persons<caret>.remove(it.next());
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// "Replace iteration with bulk 'List.removeAll' call" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
static class Person {}
|
||||
|
||||
void collectNames(List<Person> persons, Collection<Person> toRemove){
|
||||
Iterator<Person> it = toRemove.iterator();
|
||||
while (it.hasNext()) {
|
||||
Person person = it.next();
|
||||
persons<caret>.remove(person);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user