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

Comparing jsr166/src/main/java/util/concurrent/LinkedBlockingDeque.java (file contents):
Revision 1.18 by jsr166, Sun May 28 23:36:29 2006 UTC vs.
Revision 1.19 by jsr166, Sun May 18 23:47:56 2008 UTC

# Line 57 | Line 57 | public class LinkedBlockingDeque<E>
57  
58      /** Doubly-linked list node class */
59      static final class Node<E> {
60 <        E item;
60 >        E item;
61          Node<E> prev;
62          Node<E> next;
63          Node(E x, Node<E> p, Node<E> n) {
# Line 299 | Line 299 | public class LinkedBlockingDeque<E>
299      public boolean offerFirst(E e, long timeout, TimeUnit unit)
300          throws InterruptedException {
301          if (e == null) throw new NullPointerException();
302 <        long nanos = unit.toNanos(timeout);
302 >        long nanos = unit.toNanos(timeout);
303          lock.lockInterruptibly();
304          try {
305              for (;;) {
# Line 321 | Line 321 | public class LinkedBlockingDeque<E>
321      public boolean offerLast(E e, long timeout, TimeUnit unit)
322          throws InterruptedException {
323          if (e == null) throw new NullPointerException();
324 <        long nanos = unit.toNanos(timeout);
324 >        long nanos = unit.toNanos(timeout);
325          lock.lockInterruptibly();
326          try {
327              for (;;) {
# Line 398 | Line 398 | public class LinkedBlockingDeque<E>
398  
399      public E pollFirst(long timeout, TimeUnit unit)
400          throws InterruptedException {
401 <        long nanos = unit.toNanos(timeout);
401 >        long nanos = unit.toNanos(timeout);
402          lock.lockInterruptibly();
403          try {
404              for (;;) {
# Line 416 | Line 416 | public class LinkedBlockingDeque<E>
416  
417      public E pollLast(long timeout, TimeUnit unit)
418          throws InterruptedException {
419 <        long nanos = unit.toNanos(timeout);
419 >        long nanos = unit.toNanos(timeout);
420          lock.lockInterruptibly();
421          try {
422              for (;;) {
# Line 514 | Line 514 | public class LinkedBlockingDeque<E>
514       * @throws NullPointerException if the specified element is null
515       */
516      public boolean add(E e) {
517 <        addLast(e);
518 <        return true;
517 >        addLast(e);
518 >        return true;
519      }
520  
521      /**
522       * @throws NullPointerException if the specified element is null
523       */
524      public boolean offer(E e) {
525 <        return offerLast(e);
525 >        return offerLast(e);
526      }
527  
528      /**
# Line 530 | Line 530 | public class LinkedBlockingDeque<E>
530       * @throws InterruptedException {@inheritDoc}
531       */
532      public void put(E e) throws InterruptedException {
533 <        putLast(e);
533 >        putLast(e);
534      }
535  
536      /**
# Line 539 | Line 539 | public class LinkedBlockingDeque<E>
539       */
540      public boolean offer(E e, long timeout, TimeUnit unit)
541          throws InterruptedException {
542 <        return offerLast(e, timeout, unit);
542 >        return offerLast(e, timeout, unit);
543      }
544  
545      /**
# Line 553 | Line 553 | public class LinkedBlockingDeque<E>
553       * @throws NoSuchElementException if this deque is empty
554       */
555      public E remove() {
556 <        return removeFirst();
556 >        return removeFirst();
557      }
558  
559      public E poll() {
560 <        return pollFirst();
560 >        return pollFirst();
561      }
562  
563      public E take() throws InterruptedException {
564 <        return takeFirst();
564 >        return takeFirst();
565      }
566  
567      public E poll(long timeout, TimeUnit unit) throws InterruptedException {
568 <        return pollFirst(timeout, unit);
568 >        return pollFirst(timeout, unit);
569      }
570  
571      /**
# Line 579 | Line 579 | public class LinkedBlockingDeque<E>
579       * @throws NoSuchElementException if this deque is empty
580       */
581      public E element() {
582 <        return getFirst();
582 >        return getFirst();
583      }
584  
585      public E peek() {
586 <        return peekFirst();
586 >        return peekFirst();
587      }
588  
589      /**
# Line 668 | Line 668 | public class LinkedBlockingDeque<E>
668       * @throws NullPointerException  {@inheritDoc}
669       */
670      public void push(E e) {
671 <        addFirst(e);
671 >        addFirst(e);
672      }
673  
674      /**
675       * @throws NoSuchElementException {@inheritDoc}
676       */
677      public E pop() {
678 <        return removeFirst();
678 >        return removeFirst();
679      }
680  
681      // Collection methods
# Line 695 | Line 695 | public class LinkedBlockingDeque<E>
695       * @return <tt>true</tt> if this deque changed as a result of the call
696       */
697      public boolean remove(Object o) {
698 <        return removeFirstOccurrence(o);
698 >        return removeFirstOccurrence(o);
699      }
700  
701      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines