DoubleStream min() in Java with examples
java.util.stream.DoubleStream in Java 8, deals with primitive doubles. It helps to solve the problems like finding maximum value in array, finding minimum value in array, sum of all elements in array, and average of all values in array in a new way. DoubleStream min() returns an OptionalDouble describing the minimum element of this stream, or an empty optional if this stream is empty.
OptionalDouble() min() Where, OptionalDouble is a container object which may or may not contain a double value.
- Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.
- This is a special case of a reduction.
Example 1 :
Example 2 :
My Personal Notes arrow_drop_up
Please Login to comment...