Udostępnij za pośrednictwem


Collectors.AveragingDouble(IToDoubleFunction) Method

Definition

Returns a Collector that produces the arithmetic mean of a double-valued function applied to the input elements.

[Android.Runtime.Register("averagingDouble", "(Ljava/util/function/ToDoubleFunction;)Ljava/util/stream/Collector;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Util.Streams.ICollector? AveragingDouble (Java.Util.Functions.IToDoubleFunction? mapper);
[<Android.Runtime.Register("averagingDouble", "(Ljava/util/function/ToDoubleFunction;)Ljava/util/stream/Collector;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member AveragingDouble : Java.Util.Functions.IToDoubleFunction -> Java.Util.Streams.ICollector

Parameters

mapper
IToDoubleFunction

a function extracting the property to be averaged

Returns

a Collector that produces the arithmetic mean of a derived property

Attributes

Remarks

Returns a Collector that produces the arithmetic mean of a double-valued function applied to the input elements. If no elements are present, the result is 0.

The average returned can vary depending upon the order in which values are recorded, due to accumulated rounding error in addition of values of differing magnitudes. Values sorted by increasing absolute magnitude tend to yield more accurate results. If any recorded value is a NaN or the sum is at any point a NaN then the average will be NaN.

Java documentation for java.util.stream.Collectors.averagingDouble(java.util.function.ToDoubleFunction<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to