# IntSummaryStatistics

public class **IntSummaryStatistics** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [IntConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/IntConsumer.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 ints with:

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

     IntSummaryStatistics stats = people.stream()
                                        .collect(Collectors.summarizingInt(Person::getDependents));

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

<br />

### Public Constructor Summary

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

### Public Method Summary

|---|---|
| void | [accept](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html#accept(int))(int value) Records a new value into the summary information |
| void | [combine](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html#combine(java.util.IntSummaryStatistics))([IntSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html) other) Combines the state of another `IntSummaryStatistics` into this one. |
| final double | [getAverage](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.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/IntSummaryStatistics.html#getCount())() Returns the count of values recorded. |
| final int | [getMax](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html#getMax())() Returns the maximum value recorded, or `Integer.MIN_VALUE` if no values have been recorded. |
| final int | [getMin](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.html#getMin())() Returns the minimum value recorded, or `Integer.MAX_VALUE` if no values have been recorded. |
| final long | [getSum](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IntSummaryStatistics.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/IntSummaryStatistics.html#toString())() Returns a string containing a concise, human-readable description of this object. |

### 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.IntConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/IntConsumer.html)

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

## Public Constructors

#### public
**IntSummaryStatistics**
()

Construct an empty instance with zero count, zero sum,
`Integer.MAX_VALUE` min, `Integer.MIN_VALUE` max and zero
average.

## Public Methods

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

Records a new value into the summary information

##### Parameters

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

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

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

##### Parameters

| other | another `IntSummaryStatistics` |
|---|---|

##### 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.

##### Returns

- the arithmetic mean of values, or zero if none

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

Returns the count of values recorded.

##### Returns

- the count of values

#### public final int
**getMax**
()

Returns the maximum value recorded, or `Integer.MIN_VALUE` if no
values have been recorded.

##### Returns

- the maximum value, or `Integer.MIN_VALUE` if none

#### public final int
**getMin**
()

Returns the minimum value recorded, or `Integer.MAX_VALUE` if no
values have been recorded.

##### Returns

- the minimum value, or `Integer.MAX_VALUE` if none

#### public final long
**getSum**
()

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

##### 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 printable representation of this object.