Class MedianAggregator
java.lang.Object
com.github.rlacher.sortbench.processing.MedianAggregator
- All Implemented Interfaces:
Function<List<BenchmarkResult>,Double>
Aggregates a list of
BenchmarkResult instances to calculate the median value.
This aggregator aims to provide a more robust and representative summary of benchmark results by using the median, which is less susceptible to outliers caused by factors like garbage collection or JVM optimisations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(List<BenchmarkResult> results) Applies the aggregation logic to calculate the median of the benchmark result values.
-
Constructor Details
-
MedianAggregator
public MedianAggregator()Constructs a default instance ofMedianAggregator. This constructor performs no custom initialisation.
-
-
Method Details
-
apply
Applies the aggregation logic to calculate the median of the benchmark result values.- Specified by:
applyin interfaceFunction<List<BenchmarkResult>,Double> - Parameters:
results- The list ofBenchmarkResultinstances to aggregate. Must not benull.- Returns:
- The median value of the benchmark results.
- Throws:
IllegalArgumentException- If the provided list of benchmark results isnull.IllegalArgumentException- If the stream of values derived from the results is empty.
-