Package org.ethelred.util.stream
Class SummaryStatistics<T>
java.lang.Object
org.ethelred.util.stream.SummaryStatistics<T>
A stream Collector that captures basic statistics in a single result. Currently, count, max and min.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Comparable<? super A>>
Collector<A,?, SummaryStatistics<A>> A Collector that uses the natural order to determine max and min.static <B> Collector<B,?, SummaryStatistics<B>> collector(Comparator<B> comparator) A Collector that uses an explicit Comparator to determine max and min.intgetCount()getMax()getMin()
-
Method Details
-
collector
A Collector that uses the natural order to determine max and min.- Type Parameters:
A- The type of elements in the Stream- Returns:
- Collector producing SummaryStatistics.
-
collector
A Collector that uses an explicit Comparator to determine max and min.- Type Parameters:
B- The type of elements in the Stream- Parameters:
comparator- Ordering to use- Returns:
- Collector producing SummaryStatistics.
-
getMin
- Returns:
- The minimum valued element from the Stream. Empty if the Stream was empty.
-
getMax
- Returns:
- The maximum valued element from the Stream. Empty if the Stream was empty.
-
getCount
public int getCount()- Returns:
- Count of elements from the Stream
-