[concurrency-interest] Deque missing tail to head iterator.

Joshua Bloch jbloch at gmail.com
Thu Sep 8 02:01:27 EDT 2005


Jason,

This was not an intentional design decision on my part  (I designed
this interface jointly with Doug).  Historically, Java collections
haven't had descending iterators.  List has the bidirectional
ListIterator, which is a bit too complex for my tastes (even if I did
design it).  SortedSet was missing this functionality till it was
augmented by NavigableSet.  I think it might well be reasonable to add
a descendingIterator method to Deque.  I wish you had come up with the
idea six months ago.  It would be a nightmare to try to sell this idea
to Sun now, especially because it affects all the subinterfaces and
implementations of Deque:(  On the other hand, interfaces are forever.
 If we don't do add the method now, we can't ever do it.  Let's see
what Doug thinks.

      Regards,

      Josh

On 9/7/05, Jason Mehrens <jason_mehrens at hotmail.com> wrote:
> Is the absence of "tail to head" iterator (Iterator<E> descendingIterator())
> an intensional design decision?  I would think since the Deque has two ends
> a user would be able to iterate from either end.   The most apparent case
> for the "tail to head" iterator is the asLifoQueue class as it currently
> iterates from "head to tail".
> An RFE was filed against the Stack
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4475301 for this issue.
> Then again, that bug got zero votes so it must not be too important or maybe
> that could be attributed to the number of Stack users.  Just kidding.
> 
> Jason Mehrens
> 
> 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>



More information about the Concurrency-interest mailing list