public final class LongSummary extends Object implements Serializable
LongSummaryStatistics,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
long |
getCount()
Returns the count of values recorded.
|
long |
getMax()
Return the maximum value recorded, or
Long.MIN_VALUE if no
values have been recorded. |
double |
getMean()
Return the arithmetic mean of values recorded, or zero if no values have
been recorded.
|
long |
getMin()
Return the minimum value recorded, or
Long.MAX_VALUE if no
values have been recorded. |
long |
getSum()
Return the sum of values recorded, or zero if no values have been
recorded.
|
int |
hashCode() |
static LongSummary |
of(long count,
long min,
long max,
long sum,
double mean)
Create an immutable object which contains statistical summary values.
|
static LongSummary |
of(LongSummaryStatistics statistics)
Return a new value object of the statistical summary, currently
represented by the
statistics object. |
static <T> Collector<T,?,LongSummary> |
toLongSummary(ToLongFunction<? super T> mapper)
Return a
Collector which applies an long-producing mapping
function to each input element, and returns summary-statistics for the
resulting values. |
String |
toString() |
public long getCount()
public long getMin()
Long.MAX_VALUE if no
values have been recorded.Long.MAX_VALUE if nonepublic long getMax()
Long.MIN_VALUE if no
values have been recorded.Long.MIN_VALUE if nonepublic long getSum()
public double getMean()
public static LongSummary of(long count, long min, long max, long sum, double mean)
count - the count of values recordedmin - the minimum valuemax - the maximum valuesum - the sum of the recorded valuesmean - the arithmetic mean of valuespublic static LongSummary of(LongSummaryStatistics statistics)
statistics object.statistics - the creating (mutable) statistics classpublic static <T> Collector<T,?,LongSummary> toLongSummary(ToLongFunction<? super T> mapper)
Collector which applies an long-producing mapping
function to each input element, and returns summary-statistics for the
resulting values.
final Stream<SomeObject> stream = ...
final LongSummary summary = stream
.collect(toLongSummary(v -> v.longValue()));T - the type of the input elementsmapper - a mapping function to apply to each elementCollector implementing the summary-statistics reductionNullPointerException - if the given mapper is
null© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)