[concurrency-interest] FooTreeCache

Hanson Char hanson.char at gmail.com
Sun Aug 27 02:11:09 EDT 2006


Everything classes of jsr166x are now included and "augmented" with
the source from Java 6 beta (with also the missing method addded for
ConcurrentLinkedDeque):

http://beanlib.sourceforge.net/3.2.3/api/net/sf/beanlib/util/concurrent/package-summary.html

Please let me know if I screwed up anything.  Otherwise, I can start
enjoying jsr166x in Java 5 :)

Hanson

On 8/26/06, Hanson Char <hanson.char at gmail.com> wrote:
> 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
> "descendingIterator".
>
> If one were to provide the missing implementation in
> jsr166x.ConcurrentLinkedDeque, would it be something like the one
> given below ?
>
> Hanson
>
>     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