mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
stream: do not suggest collect when filter depends on collection (IDEA-122410)
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample {
|
||||
public static void main(List<String> testTags) {
|
||||
final List<String> resultJava7 = new ArrayList<>(testTags.size());
|
||||
testTags.stream().filter(tag -> !resultJava7.contains(tag.trim())).forEach(tag -> {
|
||||
resultJava7.add(tag.trim());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
abstract class Sample implements List<String> {
|
||||
void main() {
|
||||
this.stream().filter(tag -> !contains(tag.trim())).forEach(tag -> {
|
||||
add(tag.trim());
|
||||
});
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
abstract class Sample implements List<String> {
|
||||
void main() {
|
||||
this.stream().filter(tag -> !foo(this)).forEach(tag -> {
|
||||
add(tag.trim());
|
||||
});
|
||||
}
|
||||
|
||||
static boolean foo(List<String> a){ return false;}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample extends ArrayList<String> {
|
||||
void main() {
|
||||
this.stream().filter(tag -> !super.contains(tag)).forEach(tag -> {
|
||||
add(tag.trim());
|
||||
});
|
||||
}
|
||||
|
||||
static boolean foo(List<String> a){ return false;}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample {
|
||||
public static void main(List<String> testTags) {
|
||||
final List<String> resultJava7 = new ArrayList<>(testTags.size());
|
||||
testTags.stream().filter(tag -> !foo(resultJava7)).forEach(tag -> {
|
||||
resultJava7.add(tag.trim());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
static boolean foo(List<String> l) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample {
|
||||
public static void main(List<String> testTags) {
|
||||
final List<String> resultJava7 = new ArrayList<>(testTags.size());
|
||||
for (final String tag : tes<caret>tTags) {
|
||||
if (!resultJava7.contains(tag.trim())) {
|
||||
resultJava7.add(tag.trim());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
abstract class Sample implements List<String> {
|
||||
void main() {
|
||||
for (final String tag : t<caret>his) {
|
||||
if (!contains(tag.trim())) {
|
||||
add(tag.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
abstract class Sample implements List<String> {
|
||||
void main() {
|
||||
for (final String tag : t<caret>his) {
|
||||
if (!foo(this)) {
|
||||
add(tag.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static boolean foo(List<String> a){ return false;}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample extends ArrayList<String> {
|
||||
void main() {
|
||||
for (final String tag : t<caret>his) {
|
||||
if (!super.contains(tag)) {
|
||||
add(tag.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static boolean foo(List<String> a){ return false;}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Replace with forEach" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Sample {
|
||||
public static void main(List<String> testTags) {
|
||||
final List<String> resultJava7 = new ArrayList<>(testTags.size());
|
||||
for (final String tag : tes<caret>tTags) {
|
||||
if (!foo(resultJava7)) {
|
||||
resultJava7.add(tag.trim());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static boolean foo(List<String> l) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user