ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java (file contents):
Revision 1.55 by jsr166, Thu Sep 30 00:50:19 2010 UTC vs.
Revision 1.56 by jsr166, Thu Sep 30 01:35:20 2010 UTC

# Line 533 | Line 533 | public class LinkedBlockingQueue<E> exte
533      }
534  
535      /**
536 +     * Returns {@code true} if this queue contains the specified element.
537 +     * More formally, returns {@code true} if and only if this queue contains
538 +     * at least one element {@code e} such that {@code o.equals(e)}.
539 +     *
540 +     * @param o object to be checked for containment in this queue
541 +     * @return {@code true} if this queue contains the specified element
542 +     */
543 +    public boolean contains(Object o) {
544 +        if (o == null) return false;
545 +        fullyLock();
546 +        try {
547 +            for (Node<E> p = head.next; p != null; p = p.next)
548 +                if (o.equals(p.item))
549 +                    return true;
550 +            return false;
551 +        } finally {
552 +            fullyUnlock();
553 +        }
554 +    }
555 +
556 +    /**
557       * Returns an array containing all of the elements in this queue, in
558       * proper sequence.
559       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines