Package nl.vpro.util
Class MergedSortedIterator<T>
- java.lang.Object
-
- nl.vpro.util.WrappedIterator<T,T>
-
- nl.vpro.util.BasicWrappedIterator<T>
-
- nl.vpro.util.MergedSortedIterator<T>
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<T>
,CloseableIterator<T>
,CountedIterator<T>
public class MergedSortedIterator<T> extends BasicWrappedIterator<T> implements CountedIterator<T>
- Since:
- 0.32
- Author:
- Michiel Meeuwissen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
MergedSortedIterator.SameThreadMergingIterator<S>
-
Nested classes/interfaces inherited from class nl.vpro.util.BasicWrappedIterator
BasicWrappedIterator.Builder<T>
-
Nested classes/interfaces inherited from interface nl.vpro.util.CloseableIterator
CloseableIterator.WrappedCloseableIterator<S>, CloseableIterator.WrappedPeekingCloseableIterator<S>
-
-
Field Summary
-
Fields inherited from class nl.vpro.util.WrappedIterator
wrapped
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static <T> Long
getSize(Iterable<CountedIterator<T>> iterators)
protected static <T> Long
getTotalSize(Iterable<CountedIterator<T>> iterators)
static <T> MergedSortedIterator<T>
merge(Comparator<? super T> comparator, Iterable<CountedIterator<T>> iterators)
static <T> MergedSortedIterator<T>
merge(Comparator<? super T> comparator, CountedIterator<T>... iterators)
This uses guava'sIterators.mergeSorted(java.lang.Iterable<? extends java.util.Iterator<? extends T>>, java.util.Comparator<? super T>)
.static <T> MergedSortedIterator<T>
mergeInSameThread(Comparator<? super T> comparator, Iterable<CountedIterator<T>> iterators)
This doesn't usea queue, so it is also useable with Hibernate.static <T> MergedSortedIterator<T>
mergeInSameThread(Comparator<? super T> comparator, CountedIterator<T>... iterators)
This doesn't use a queue, so it is also useable with Hibernate.-
Methods inherited from class nl.vpro.util.BasicWrappedIterator
builder, getCount, getSize, getTotalSize, next
-
Methods inherited from class nl.vpro.util.WrappedIterator
close, hasNext, iterator, remove, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface nl.vpro.util.CountedIterator
close, getCount, getSize, getTotalSize, peeking, spliterator, stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
merge
@SafeVarargs public static <T> MergedSortedIterator<T> merge(Comparator<? super T> comparator, CountedIterator<T>... iterators)
This uses guava'sIterators.mergeSorted(java.lang.Iterable<? extends java.util.Iterator<? extends T>>, java.util.Comparator<? super T>)
. This probable performs well, but will use a queue.
-
mergeInSameThread
@SafeVarargs public static <T> MergedSortedIterator<T> mergeInSameThread(Comparator<? super T> comparator, CountedIterator<T>... iterators)
This doesn't use a queue, so it is also useable with Hibernate.
-
merge
public static <T> MergedSortedIterator<T> merge(Comparator<? super T> comparator, Iterable<CountedIterator<T>> iterators)
-
mergeInSameThread
public static <T> MergedSortedIterator<T> mergeInSameThread(Comparator<? super T> comparator, Iterable<CountedIterator<T>> iterators)
This doesn't usea queue, so it is also useable with Hibernate.
-
getSize
protected static <T> Long getSize(Iterable<CountedIterator<T>> iterators)
-
getTotalSize
protected static <T> Long getTotalSize(Iterable<CountedIterator<T>> iterators)
-
-