Package org.dmfs.jems2.iterator
Class Clustered<T>
An
Iterator decorator which clusters consecutive elements of another Iterator 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]
]
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.dmfs.jems2.iterator.BaseIterator
equals, hashCode, removeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
Clustered
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-