mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
IDEA-178788 Suggestion code replace from list iteration to List.removeAll
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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