average abstract method

Optional<double> average()

Computes and returns the average, or an empty Optional if the stream is empty.

Example

final avg = DoubleStream.of([1.0, 2.0, 3.0]).average(); // Optional(2.0)

Implementation

Optional<double> average();