public final class LongSummary extends Object implements Serializable
LongSummaryStatistics
,
Serialized FormModifier and Type | Method and Description |
---|---|
long |
count()
Returns the count of values recorded.
|
boolean |
equals(Object obj) |
long |
getCount()
Deprecated.
Use
count() instead |
long |
getMax()
Deprecated.
Use
max() instead |
double |
getMean()
Return the arithmetic mean of values recorded, or zero if no values have
been recorded.
|
long |
getMin()
Deprecated.
Use
min() instead |
long |
getSum()
Deprecated.
Use
sum() instead |
int |
hashCode() |
long |
max()
Return the maximum value recorded, or
Long.MIN_VALUE if no
values have been recorded. |
static long |
max(long[] values)
Return the maximum value of the given double array.
|
static double |
mean(long[] values)
Returns a double describing the arithmetic mean of the values, or
Double.NaN if the values array is empty. |
long |
min()
Return the minimum value recorded, or
Long.MAX_VALUE if no
values have been recorded. |
static long |
min(long[] values)
Return the minimum value of the given double array.
|
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. |
long |
sum()
Return the sum of values recorded, or zero if no values have been
recorded.
|
static long |
sum(long[] values)
Return the sum of the given double array.
|
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 count()
@Deprecated public long getCount()
count()
insteadpublic long min()
Long.MAX_VALUE
if no
values have been recorded.Long.MAX_VALUE
if none@Deprecated public long getMin()
min()
insteadLong.MAX_VALUE
if no
values have been recorded.Long.MAX_VALUE
if nonepublic long max()
Long.MIN_VALUE
if no
values have been recorded.Long.MIN_VALUE
if none@Deprecated public long getMax()
max()
insteadLong.MIN_VALUE
if no
values have been recorded.Long.MIN_VALUE
if nonepublic long sum()
@Deprecated public long getSum()
sum()
insteadpublic 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
public static long min(long[] values)
values
- the array.Long.MAX_VALUE
if the given array is
empty.NullPointerException
- if the given array is null
.public static long max(long[] values)
values
- the array.Long.MIN_VALUE
if the given array is
empty.NullPointerException
- if the given array is null
.public static long sum(long[] values)
values
- the values to sum up.values
.NullPointerException
- if the given array is null
.public static double mean(long[] values)
Double.NaN
if the values
array is empty.values
- the values to calculate the mean ofvalues
or
Double.NaN
if the values
array is emptyNullPointerException
- if the given array is null
.© 2007-2020 Franz Wilhelmstötter (2020-02-18 20:01)