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>`

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 Summary

  Constructors
  Constructor
  Description
  `MergeSortedIterator(Iterator<A> one, Iterator<A> two, Comparator<A> comparator, BiFunction<A,A,E> mergeFunction)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasNext()`
  `E`
  `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 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>`