@Test(expected = IllegalStateException.class) public void basic3() { List<CloneableInteger> a = Lists.newArrayList(new CloneableInteger(2), new CloneableInteger(1)); List<CloneableInteger> b = Lists.newArrayList(); List<CloneableInteger> c = Lists.newArrayList(new CloneableInteger(1), new CloneableInteger(2), new CloneableInteger(5)); List<Iterator<CloneableInteger>> input = Lists.newArrayList(); input.add(a.iterator()); input.add(b.iterator()); input.add(c.iterator()); SortedIteratorMergerWithLimit<CloneableInteger> merger = new SortedIteratorMergerWithLimit<CloneableInteger>(input.iterator(), 3, getComp()); Iterator<CloneableInteger> iterator = merger.getIterator(); List<CloneableInteger> result = Lists.newArrayList(); while (iterator.hasNext()) { result.add(iterator.next()); } }
@Override public Iterator<E> getIterator() { return new MergedIteratorWithLimit(limit, comparator); }
SortedIteratorMergerWithLimit extends SortedIteratorMerger<E> { @Override public Iterator<E> getIterator() { return new MergedIteratorWithLimit(limit, comparator); } }
SortedIteratorMergerWithLimit extends SortedIteratorMerger<E> { @Override public Iterator<E> getIterator() { return new MergedIteratorWithLimit(limit, comparator); } SortedIteratorMergerWithLimit(Iterator<Iterator<E>> shardSubsets, int limit, Comparator<E> comparator); }
SortedIteratorMergerWithLimit extends SortedIteratorMerger<E> { @Override public Iterator<E> getIterator() { return new MergedIteratorWithLimit(limit, comparator); } SortedIteratorMergerWithLimit(Iterator<Iterator<E>> shardSubsets, int limit, Comparator<E> comparator); @Override Iterator<E> getIterator(); }
SortedIteratorMergerWithLimit extends SortedIteratorMerger<E> { @Override public Iterator<E> getIterator() { return new MergedIteratorWithLimit(limit, comparator); } SortedIteratorMergerWithLimit(Iterator<Iterator<E>> shardSubsets, int limit, Comparator<E> comparator); @Override Iterator<E> getIterator();  }