Class MergingKvIterator<K extends Comparable<K>,V>

java.lang.Object
com.usatiuk.objects.iterators.ReversibleKvIterator<K,V>
com.usatiuk.objects.iterators.MergingKvIterator<K,V>
Type Parameters:
K - the type of the keys
V - the type of the values
All Implemented Interfaces:
CloseableKvIterator<K,V>, AutoCloseable, Iterator<org.apache.commons.lang3.tuple.Pair<K,V>>

public class MergingKvIterator<K extends Comparable<K>,V> extends ReversibleKvIterator<K,V>
A merging key-value iterator that combines multiple iterators into a single iterator.
  • Constructor Details

    • MergingKvIterator

      public MergingKvIterator(IteratorStart startType, K startKey, List<CloseableKvIterator<K,V>> iterators)
      Constructs a MergingKvIterator with the specified start type, start key, and list of iterators. The iterators have priority based on their order in the list: if two iterators have the same key, the one that is in the beginning of the list will be used.
      Parameters:
      startType - the starting position relative to the startKey
      startKey - the starting key
      iterators - the list of iterators to merge
    • MergingKvIterator

      @SafeVarargs public MergingKvIterator(IteratorStart startType, K startKey, CloseableKvIterator<K,V>... iterators)
      Constructs a MergingKvIterator with the specified start type, start key, and array of iterators. The iterators have priority based on their order in the array: if two iterators have the same key, the one that is in the beginning of the array will be used.
      Parameters:
      startType - the starting position relative to the startKey
      startKey - the starting key
      iterators - the array of iterators to merge
  • Method Details