IDEA-205308 'Replace with max()' produces uncompilable source

This commit is contained in:
Tagir Valeev
2019-01-15 13:14:19 +07:00
parent a3ed07435e
commit cfd0c17038
3 changed files with 33 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
// "Replace with max()" "true"
import java.util.Collection;
class Scratch {
native int scale();
private static Integer getMaxScale(Collection<Scratch> updated) {
int maxScale = updated.stream().mapToInt(Scratch::scale).filter(b -> b >= 0).max().orElse(0);
return maxScale;
}
}

View File

@@ -0,0 +1,17 @@
// "Replace with max()" "true"
import java.util.Collection;
class Scratch {
native int scale();
private static Integer getMaxScale(Collection<Scratch> updated) {
int maxScale = 0;
f<caret>or (Scratch b : updated) {
if (maxScale < b.scale()) {
maxScale = b.scale();
}
}
return maxScale;
}
}