mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-183326 Comment disappears in stream to loop
This commit is contained in:
+5
-5
@@ -6,10 +6,10 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class Test {
|
||||
void testList(List<String> input) {
|
||||
List<String> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new ArrayList<>(10)));
|
||||
List<String> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new ArrayList<>(/*initial size*/10)));
|
||||
System.out.println(result);
|
||||
|
||||
ArrayList<String> result2 = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new ArrayList<>(20)));
|
||||
ArrayList<String> result2 = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new ArrayList<>/*valuable comment*/(20)));
|
||||
System.out.println(result2);
|
||||
|
||||
// Non-empty
|
||||
@@ -26,10 +26,10 @@ public class Test {
|
||||
}
|
||||
|
||||
void testSet(List<String> input) {
|
||||
Set<String> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new HashSet<>(10)));
|
||||
Set<String> result = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new HashSet/*comment*/<>(/*size*/10)));
|
||||
System.out.println(result);
|
||||
|
||||
Collection<String> result2 = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new LinkedHashSet<>(20, 0.8f)));
|
||||
Collection<String> result2 = input.stream().filter(s -> !s.isEmpty()).collect(Collectors.toCollection(() -> new LinkedHashSet<>(20, /*load factor*/ 0.8f)));
|
||||
System.out.println(result2);
|
||||
|
||||
// Non-empty
|
||||
@@ -37,7 +37,7 @@ public class Test {
|
||||
input.stream().filter(s -> !s.isEmpty()).forEach(result3::add);
|
||||
System.out.println(result3);
|
||||
|
||||
Collection<TimeUnit> result4 = input.stream().filter(s -> !s.isEmpty()).map(TimeUnit::valueOf).collect(Collectors.toCollection(() -> EnumSet.noneOf(TimeUnit.class)));
|
||||
Collection<TimeUnit> result4 = input.stream().filter(s -> !s.isEmpty()).map(TimeUnit::valueOf).collect(Collectors.toCollection(() -> EnumSet.noneOf(/*timeunits*/TimeUnit.class)));
|
||||
System.out.println(result4);
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -11,5 +11,6 @@ public class Collect {
|
||||
|
||||
void collectNames(List<Person> persons){
|
||||
Set<String> names = persons.stream().map(Person::getName).collect(Collectors.toSet());
|
||||
/*valuable comment*/
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Test {
|
||||
void testList(List<String> input) {
|
||||
List<String> result = new ArrayList<>(10);
|
||||
List<String> result = new ArrayList<>(/*initial size*/10);
|
||||
for (String s : in<caret>put) {
|
||||
if (!s.isEmpty()) {
|
||||
result.add(s);
|
||||
@@ -13,7 +13,7 @@ public class Test {
|
||||
}
|
||||
System.out.println(result);
|
||||
|
||||
ArrayList<String> result2 = new ArrayList<>(20);
|
||||
ArrayList<String> result2 = new ArrayList<>/*valuable comment*/(20);
|
||||
for (String s : input) {
|
||||
if (!s.isEmpty()) {
|
||||
result2.add(s);
|
||||
@@ -43,7 +43,7 @@ public class Test {
|
||||
}
|
||||
|
||||
void testSet(List<String> input) {
|
||||
Set<String> result = new HashSet<>(10);
|
||||
Set<String> result = new HashSet/*comment*/<>(/*size*/10);
|
||||
for (String s : input) {
|
||||
if (!s.isEmpty()) {
|
||||
result.add(s);
|
||||
@@ -51,7 +51,7 @@ public class Test {
|
||||
}
|
||||
System.out.println(result);
|
||||
|
||||
Collection<String> result2 = new LinkedHashSet<>(20, 0.8f);
|
||||
Collection<String> result2 = new LinkedHashSet<>(20, /*load factor*/ 0.8f);
|
||||
for (String s : input) {
|
||||
if (!s.isEmpty()) {
|
||||
result2.add(s);
|
||||
@@ -68,7 +68,7 @@ public class Test {
|
||||
}
|
||||
System.out.println(result3);
|
||||
|
||||
Collection<TimeUnit> result4 = EnumSet.noneOf(TimeUnit.class);
|
||||
Collection<TimeUnit> result4 = EnumSet.noneOf(/*timeunits*/TimeUnit.class);
|
||||
for (String s : input) {
|
||||
if (!s.isEmpty()) {
|
||||
result4.add(TimeUnit.valueOf(s));
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ public class Collect {
|
||||
}
|
||||
|
||||
void collectNames(List<Person> persons){
|
||||
Set<String> names = new HashSet<>();
|
||||
Set<String> names = new HashSet/*valuable comment*/<>();
|
||||
for (Person person : pers<caret>ons) {
|
||||
names.add(person.getName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user