Package fr.gouv.vitam.batch.report.model
Class MergeSortedIterator<A,E>
java.lang.Object
fr.gouv.vitam.batch.report.model.MergeSortedIterator<A,E>
- Type Parameters:
A
-E
-
- All Implemented Interfaces:
Iterator<E>
This Iterator take two sorted iterators and merge them.
Loop over iterators and use comparator in order to take items that are equals.
The merge is done using the function mergeFunction
-
Constructor Summary
ConstructorDescriptionMergeSortedIterator
(Iterator<A> one, Iterator<A> two, Comparator<A> comparator, BiFunction<A, A, E> mergeFunction) -
Method Summary
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 Details
-
MergeSortedIterator
public MergeSortedIterator(Iterator<A> one, Iterator<A> two, Comparator<A> comparator, BiFunction<A, A, E> mergeFunction) - Parameters:
one
- The first sorted iteratortwo
- The second sorted iteratorcomparator
- The comparator that compare items of iteratorsmergeFunction
- The function that merge elements of iterators
-
-
Method Details