StreamToLoop: add variable name suggestions from method reference output variable

This commit is contained in:
Tagir Valeev
2016-12-09 10:33:49 +07:00
parent a6cf0fbcfb
commit c7ccea5186
3 changed files with 32 additions and 13 deletions
@@ -9,10 +9,10 @@ public class Main {
boolean seen = false;
double best = 0;
for (String string : strings) {
double v = string.length();
if (!seen || Double.compare(v, best) > 0) {
double length = string.length();
if (!seen || Double.compare(length, best) > 0) {
seen = true;
best = v;
best = length;
}
}
return (seen ? OptionalDouble.of(best) : OptionalDouble.empty()).orElse(-1);
@@ -9,10 +9,10 @@ public class Main {
boolean seen = false;
int best = 0;
for (String string : strings) {
int i = string.length();
if (!seen || i < best) {
int length = string.length();
if (!seen || length < best) {
seen = true;
best = i;
best = length;
}
}
return (seen ? OptionalInt.of(best) : OptionalInt.empty()).orElse(-1);