mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
IDEA-170032 Replace with foreach is not proposed in alt-enter
Now both options (when unchecked) only disable warning and batch-mode replacement, but the action is still available as an intention.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
void fun(List<String>... lists) {
|
||||
Arrays.stream(lists).forEach(list -> list.add(""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
public void foo(final Set<String> strings) throws FileNotFoundException {
|
||||
strings.forEach(s -> new FileInputStream());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
public static void main(String[] args) {
|
||||
List<String> names = Arrays.asList("Bob", "Alice", "Bob", "Carol");
|
||||
Set<String> uniqNames = new HashSet<>(names.size());
|
||||
names.forEach(name -> uniqNames.add(makeNameUnique(name, uniqNames)));
|
||||
uniqNames.forEach(System.out::println);
|
||||
}
|
||||
|
||||
private static String makeNameUnique(final String name, final Set<String> uniqNames) {
|
||||
if (uniqNames.contains(name)) {
|
||||
return name + "1";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with forEach" "false"
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with forEach" "false"
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with forEach" "false"
|
||||
// "Replace with forEach" "INFORMATION"
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
|
||||
Reference in New Issue
Block a user