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

Comparing jsr166/src/main/java/util/concurrent/SynchronousQueue.java (file contents):
Revision 1.20 by dl, Mon Sep 15 12:02:46 2003 UTC vs.
Revision 1.21 by dl, Sun Oct 5 23:00:18 2003 UTC

# Line 550 | Line 550 | public class SynchronousQueue<E> extends
550              a[0] = null;
551          return a;
552      }
553 +
554 +
555 +    public int drainTo(Collection<? super E> c) {
556 +        if (c == null)
557 +            throw new NullPointerException();
558 +        if (c == this)
559 +            throw new IllegalArgumentException();
560 +        int n = 0;
561 +        E e;
562 +        while ( (e = poll()) != null) {
563 +            c.add(e);
564 +            ++n;
565 +        }
566 +        return n;
567 +    }
568 +
569 +    public int drainTo(Collection<? super E> c, int maxElements) {
570 +        if (c == null)
571 +            throw new NullPointerException();
572 +        if (c == this)
573 +            throw new IllegalArgumentException();
574 +        int n = 0;
575 +        E e;
576 +        while (n < maxElements && (e = poll()) != null) {
577 +            c.add(e);
578 +            ++n;
579 +        }
580 +        return n;
581 +    }
582   }
583  
584  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines