Class DistinctValuesAggregator<K,V>
java.lang.Object
com.loomcache.server.compute.DistinctValuesAggregator<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
- All Implemented Interfaces:
Aggregator<K,V, Set<V>>
Built-in aggregator that collects distinct values from the map.
Returns an unmodifiable Set containing all unique values found in the map. Null values are skipped.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new distinct values aggregator with the default capacity limit.DistinctValuesAggregator(int maxDistinctValues) Create a new distinct values aggregator with a custom capacity limit. -
Method Summary
-
Constructor Details
-
DistinctValuesAggregator
public DistinctValuesAggregator()Create a new distinct values aggregator with the default capacity limit. -
DistinctValuesAggregator
public DistinctValuesAggregator(int maxDistinctValues) Create a new distinct values aggregator with a custom capacity limit.- Parameters:
maxDistinctValues- the maximum number of distinct values to retain
-
-
Method Details
-
accumulate
Description copied from interface:AggregatorAccumulate a single entry into this aggregator.This method is called once for each entry in the map during the scan.
- Specified by:
accumulatein interfaceAggregator<K,V, Set<V>> - Parameters:
entry- the entry to accumulate (may be null if entry was deleted)
-
combine
Description copied from interface:AggregatorCombine this aggregator with another from a parallel execution.This method is used to merge results from multiple parallel aggregations into a single result. Implementations should combine the internal state of both aggregators.
-
aggregate
Description copied from interface:AggregatorGet the final aggregated result.This is called after all entries have been accumulated and all partial results have been combined.
-