# DoubleSummaryStatistics

public class **DoubleSummaryStatistics** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [DoubleConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html) A state object for collecting statistics such as count, min, max, sum, and
average.

This class is designed to work with (though does not require)
{@linkplain java.util.stream streams}. For example, you can compute
summary statistics on a stream of doubles with:

     DoubleSummaryStatistics stats = doubleStream.collect(DoubleSummaryStatistics::new,
                                                          DoubleSummaryStatistics::accept,
                                                          DoubleSummaryStatistics::combine);
     
`DoubleSummaryStatistics` can be used as a
{@linkplain java.util.stream.Stream#collect(Collector) reduction}
target for a {@linkplain java.util.stream.Stream stream}. For example:

     DoubleSummaryStatistics stats = people.stream()
         .collect(Collectors.summarizingDouble(Person::getWeight));

This computes, in a single pass, the count of people, as well as the minimum, maximum, sum, and average of their weights.

<br />

### Public Constructor Summary

|---|---|
|   | [DoubleSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#DoubleSummaryStatistics())() Construct an empty instance with zero count, zero sum, `Double.POSITIVE_INFINITY` min, `Double.NEGATIVE_INFINITY` max and zero average. |

### Public Method Summary

|---|---|
| void | [accept](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#accept(double))(double value) Records another value into the summary information. |
| void | [combine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#combine(java.util.DoubleSummaryStatistics))([DoubleSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html) other) Combines the state of another `DoubleSummaryStatistics` into this one. |
| final double | [getAverage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getAverage())() Returns the arithmetic mean of values recorded, or zero if no values have been recorded. |
| final long | [getCount](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getCount())() Return the count of values recorded. |
| final double | [getMax](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getMax())() Returns the maximum recorded value, `Double.NaN` if any recorded value was NaN or `Double.NEGATIVE_INFINITY` if no values were recorded. |
| final double | [getMin](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getMin())() Returns the minimum recorded value, `Double.NaN` if any recorded value was NaN or `Double.POSITIVE_INFINITY` if no values were recorded. |
| final double | [getSum](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getSum())() Returns the sum of values recorded, or zero if no values have been recorded. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#toString())() Returns a string containing a concise, human-readable description of this object. Returns a non-empty string representation of this object suitable for debugging. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.function.DoubleConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html)

|---|---|
| abstract void | [accept](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html#accept(double))(double value) Performs this operation on the given argument. |
| [DoubleConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html) | [andThen](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html#andThen(java.util.function.DoubleConsumer))([DoubleConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/DoubleConsumer.html) after) Returns a composed `DoubleConsumer` that performs, in sequence, this operation followed by the `after` operation. |

## Public Constructors

#### public
**DoubleSummaryStatistics**
()

Construct an empty instance with zero count, zero sum,
`Double.POSITIVE_INFINITY` min, `Double.NEGATIVE_INFINITY`
max and zero average.

## Public Methods

#### public void
**accept**
(double value)

Records another value into the summary information.

##### Parameters

| value | the input value |
|---|---|

#### public void
**combine**
([DoubleSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html) other)

Combines the state of another `DoubleSummaryStatistics` into this
one.

##### Parameters

| other | another `DoubleSummaryStatistics` |
|---|---|

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `other` is null |
|---|---|

#### public final double
**getAverage**
()

Returns the arithmetic mean of values recorded, or zero if no
values have been recorded.

If any recorded value is a NaN or the sum is at any point a NaN
then the average will be code NaN.

The average returned can vary depending upon the order in
which values are recorded.

This method may be implemented using compensated summation or
other technique to reduce the error bound in the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DoubleSummaryStatistics.html#getSum()` used to compute the average.

##### Returns

- the arithmetic mean of values, or zero if none

#### public final long
**getCount**
()

Return the count of values recorded.

##### Returns

- the count of values

#### public final double
**getMax**
()

Returns the maximum recorded value, `Double.NaN` if any recorded
value was NaN or `Double.NEGATIVE_INFINITY` if no values were
recorded. Unlike the numerical comparison operators, this method
considers negative zero to be strictly smaller than positive zero.

##### Returns

- the maximum recorded value, `Double.NaN` if any recorded value was NaN or `Double.NEGATIVE_INFINITY` if no values were recorded

#### public final double
**getMin**
()

Returns the minimum recorded value, `Double.NaN` if any recorded
value was NaN or `Double.POSITIVE_INFINITY` if no values were
recorded. Unlike the numerical comparison operators, this method
considers negative zero to be strictly smaller than positive zero.

##### Returns

- the minimum recorded value, `Double.NaN` if any recorded value was NaN or `Double.POSITIVE_INFINITY` if no values were recorded

#### public final double
**getSum**
()

Returns the sum of values recorded, or zero if no values have been
recorded.

If any recorded value is a NaN or the sum is at any point a NaN
then the sum will be NaN.

The value of a floating-point sum is a function both of the
input values as well as the order of addition operations. The
order of addition operations of this method is intentionally
not defined to allow for implementation flexibility to improve
the speed and accuracy of the computed result.

In particular, this method may be implemented using compensated
summation or other technique to reduce the error bound in the
numerical sum compared to a simple summation of `double`
values.

##### Returns

- the sum of values, or zero if none

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a string containing a concise, human-readable description of this
object. Subclasses are encouraged to override this method and provide an
implementation that takes into account the object's type and data. The
default implementation is equivalent to the following expression:

```
   getClass().getName() + '@' + Integer.toHexString(hashCode())
```

See [Writing a useful
`toString` method](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#writing_toString)
if you intend implementing your own `toString` method.

Returns a non-empty string representation of this object suitable for
debugging. The exact presentation format is unspecified and may vary
between implementations and versions.

##### Returns

- a printable representation of this object.