Updating some math methods to Java 8 Streaming API