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

Comparing jsr166/src/main/java/util/ArrayDeque.java (file contents):
Revision 1.83 by jsr166, Sun Oct 23 00:28:41 2016 UTC vs.
Revision 1.85 by jsr166, Sun Oct 23 19:30:54 2016 UTC

# Line 187 | Line 187 | public class ArrayDeque<E> extends Abstr
187          Object[] elements = c.toArray();
188          // defend against c.toArray (incorrectly) not returning Object[]
189          // (see e.g. https://bugs.openjdk.java.net/browse/JDK-6260652)
190 +        size = elements.length;
191          if (elements.getClass() != Object[].class)
192              elements = Arrays.copyOf(elements, size, Object[].class);
193          for (Object obj : elements)
194              Objects.requireNonNull(obj);
194        size = elements.length;
195          this.elements = elements;
196      }
197  
# Line 365 | Line 365 | public class ArrayDeque<E> extends Abstr
365       */
366      public E removeFirst() {
367          // checkInvariants();
368 <        E x = pollFirst();
369 <        if (x == null)
368 >        E e = pollFirst();
369 >        if (e == null)
370              throw new NoSuchElementException();
371 <        return x;
371 >        return e;
372      }
373  
374      /**
# Line 376 | Line 376 | public class ArrayDeque<E> extends Abstr
376       */
377      public E removeLast() {
378          // checkInvariants();
379 <        E x = pollLast();
380 <        if (x == null)
379 >        E e = pollLast();
380 >        if (e == null)
381              throw new NoSuchElementException();
382 <        return x;
382 >        return e;
383      }
384  
385      public E pollFirst() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines