mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-160946 Labeled continue is excluded; understand if(..) continue else {...}; more tests
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Main {
|
||||
|
||||
public List<String> test(Map<String, List<String>> map) {
|
||||
List<String> result = map.entrySet().stream().filter(entry -> !entry.getKey().isEmpty()).map(Map.Entry::getValue).filter(Objects::nonNull).flatMap(Collection::stream).map(String::trim).filter(trimmed -> !trimmed.isEmpty()).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Main {
|
||||
|
||||
public List<String> test(Map<String, List<String>> map) {
|
||||
List<String> result = map.entrySet().stream().filter(entry -> !entry.getKey().isEmpty()).map(Map.Entry::getValue).filter(Objects::nonNull).flatMap(Collection::stream).map(String::trim).filter(trimmed -> !trimmed.isEmpty()).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Main {
|
||||
|
||||
public List<String> test(Map<String, List<String>> map) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(Map.Entry<String, List<String>> entry : map.en<caret>trySet()) {
|
||||
if(entry.getKey().isEmpty()) continue;
|
||||
List<String> list = entry.getValue();
|
||||
if(list == null) continue;
|
||||
for(String str : list) {
|
||||
String trimmed = str.trim();
|
||||
if(trimmed.isEmpty()) continue;
|
||||
result.add(trimmed);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Main {
|
||||
|
||||
public List<String> test(Map<String, List<String>> map) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(Map.Entry<String, List<String>> entry : map.en<caret>trySet()) {
|
||||
if(entry.getKey().isEmpty()) continue;
|
||||
else {
|
||||
List<String> list = entry.getValue();
|
||||
if (list == null) continue;
|
||||
for (String str : list) {
|
||||
String trimmed = str.trim();
|
||||
if (trimmed.isEmpty()) continue;
|
||||
else result.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// "Replace with forEach" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Main {
|
||||
|
||||
public List<String> test(Map<String, List<String>> map) {
|
||||
List<String> result = new ArrayList<>();
|
||||
outer:
|
||||
for(Map.Entry<String, List<String>> entry : map.ent<caret>rySet()) {
|
||||
if(entry.getKey().isEmpty()) continue;
|
||||
List<String> list = entry.getValue();
|
||||
if(list == null) continue;
|
||||
for(String str : list) {
|
||||
String trimmed = str.trim();
|
||||
if(trimmed.isEmpty()) continue outer;
|
||||
result.add(trimmed);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user