IDEA-167588 Uncompilable code after conversion Stream -> Loop with unknown Stream sources

This commit is contained in:
Tagir Valeev
2017-02-02 21:50:50 +03:00
parent f74272f05e
commit 803b3aa940
4 changed files with 40 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
// "Replace Stream API chain with loop" "true"
// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -21,4 +22,17 @@ public class Test {
}
}
}
private long counter(Class<? extends Array> list) {
long count = 0L;
for (Iterator<? extends Array> it = stream(list).iterator(); it.hasNext(); ) {
Array array = it.next();
count++;
}
return count;
}
public <E> Stream<E> stream(Class<E> clazz) {
return null;
}
}

View File

@@ -1,5 +1,6 @@
// "Replace Stream API chain with loop" "true"
// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
import java.lang.reflect.Array;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -13,4 +14,12 @@ public class Test {
List<String> list = new Test().names().map(String::trim).filter(n -> !n.isEmpty())
.<caret>collect(Collectors.toList());
}
private long counter(Class<? extends Array> list) {
return stream(list).count();
}
public <E> Stream<E> stream(Class<E> clazz) {
return null;
}
}