StreamToLoop: support Optional unwrap if possible

This commit is contained in:
Tagir Valeev
2016-12-09 15:15:05 +07:00
parent ae273b6c24
commit 8e128b7f32
27 changed files with 425 additions and 90 deletions

View File

@@ -16,7 +16,7 @@ public class Main {
count++;
}
}
return count == 0 ? 0.0 : (double) sum / count;
return count > 0 ? (double) sum / count : 0.0;
};
System.out.println(s.getAsDouble());
}