Package org.cactoos.iterator
Class Sorted<T>
- java.lang.Object
-
- org.cactoos.iterator.Sorted<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T
next()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Constructor Detail
-
Sorted
public Sorted(Iterator<? extends T> items)
Ctor.If you're using this ctor you must be sure that type
T
implementsComparable
interface. Otherwise, there will be a type casting exception in runtime.- Parameters:
items
- The underlying iterator
-
Sorted
public Sorted(Comparator<? super T> comparator, Iterator<? extends T> iterator)
Ctor.- Parameters:
comparator
- The comparatoriterator
- The underlying iterator
-
-