[concurrency-interest] FooTreeCache

Hanson Char hanson.char at gmail.com
Sun Aug 27 01:33:52 EDT 2006

It seems java.util.Deque has an extra method than jsr166x.Deque:

    Iterator<E> descendingIterator();

In jsr166x.ConcurrentLinkedDeque, there exists the implementation for the method

    public Iterator<E> iterator();

However, there is no existing implementation for the method

If one were to provide the missing implementation in
jsr166x.ConcurrentLinkedDeque, would it be something like the one
given below ?


    public Iterator<E> descendingIterator() {
        return new CLDDescendingIterator();

    final class CLDDescendingIterator implements Iterator<E>
        Node<E> last;
        Node<E> next = trailer.back();

        public boolean hasNext() {
            return next != null;

        public E next() {
            Node<E> l = last = next;
            if (l == null)
                throw new NoSuchElementException();
            next = next.back();
            return l.element;

        public void remove() {
            Node<E> l = last;
            if (l == null)
                throw new IllegalStateException();
            while (!l.delete() && !l.isDeleted())

On 8/26/06, Hanson Char <hanson.char at gmail.com> wrote:
> Just curious.  Why is it that all the classes in jsr166x exist in Java
> 6 beta, except the ConcurrentLinkedDeque ?
> Hanson

More information about the Concurrency-interest mailing list