/** * Constructs a new <code>CollatingIterator</code> that will used the * specified comparator for ordering and have the specified initial * capacity. Child iterators will have to be manually added using the * {@link #addIterator(Iterator)} method. * * @param comp the comparator to use to sort; must not be null, * unless you'll be invoking {@link #setComparator(Comparator)} later on. * @param initIterCapacity the initial capacity for the internal list of * child iterators */ public CollatingIterator(final Comparator<? super E> comp, final int initIterCapacity) { iterators = new ArrayList<>(initIterCapacity); setComparator(comp); }