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>

public class MergeSortedIterator<A,E> extends Object implements 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 Details

    • MergeSortedIterator

      public MergeSortedIterator(Iterator<A> one, Iterator<A> two, Comparator<A> comparator, BiFunction<A,A,E> mergeFunction)
      Parameters:
      one - The first sorted iterator
      two - The second sorted iterator
      comparator - The comparator that compare items of iterators
      mergeFunction - The function that merge elements of iterators
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<A>
    • next

      public E next()
      Specified by:
      next in interface Iterator<A>