Closed GoogleCodeExporter closed 9 years ago
Thanks for the contribution. However, I doubt there's much demand for a
PeekingListIterator.
Since neither ListIterators or PeekingIterators are needed that often, a
combination
of the two would probably be a rare occurrence. Index-based logic usually leads
to
more readable code than using ListIterators, though it may not work in the case
you're describing.
Original comment by jared.l....@gmail.com
on 30 Oct 2009 at 6:21
Yup, figured so; essentially am using it as:
List<V> kwaymerge (Iterable<Iterable<V>> sources) {
List<V> result;
if (sources.hasNext()) {
result = Lists.newLinkedList(sources.next());
} else return Lists.newLinkedList();
PeekingListIterator<V> primary;
PeekingIterator<V> from;
while(sources.hasNext()) {
primary = ListIterators.peekingListIterator(result.listIterator());
secondary = Iterators.peekingIterator(sources.next());
// merge logic, which is simplified by being able to add with the ListIterator
}
return result;
}
Original comment by blank...@gmail.com
on 30 Oct 2009 at 11:30
If the need for this starts cropping up more than we expect, we'll reopen this
issue.
Original comment by kevin...@gmail.com
on 30 Oct 2009 at 4:00
Original issue reported on code.google.com by
blank...@gmail.com
on 30 Oct 2009 at 4:39Attachments: