Package org.dmfs.jems2.iterable
Class Clustered<T>
java.lang.Object
org.dmfs.jems2.iterable.Clustered<T>
An
Iterable decorator which clusters consecutive elements of another Iterable by the result of a Comparator. Consecutive elements
which compare to 0 go into the same cluster. The original order of the elements remains the same.
Clustered(Comparator.naturalOrder(), [5, 5, 5, 3, 3, 4, 4, 4, 5, 5, 2, 2]) ->
[
[5, 5, 5],
[3, 3],
[4, 4, 4],
[5, 5],
[2, 2]
]