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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedDeque.java (file contents):
Revision 1.77 by jsr166, Mon Dec 5 03:02:49 2016 UTC vs.
Revision 1.78 by jsr166, Tue Dec 6 05:15:22 2016 UTC

# Line 836 | Line 836 | public class ConcurrentLinkedDeque<E>
836  
837      public E peekFirst() {
838          for (Node<E> p = first(); p != null; p = succ(p)) {
839 <            E item = p.item;
840 <            if (item != null)
839 >            final E item;
840 >            if ((item = p.item) != null)
841                  return item;
842          }
843          return null;
# Line 845 | Line 845 | public class ConcurrentLinkedDeque<E>
845  
846      public E peekLast() {
847          for (Node<E> p = last(); p != null; p = pred(p)) {
848 <            E item = p.item;
849 <            if (item != null)
848 >            final E item;
849 >            if ((item = p.item) != null)
850                  return item;
851          }
852          return null;
# Line 868 | Line 868 | public class ConcurrentLinkedDeque<E>
868  
869      public E pollFirst() {
870          for (Node<E> p = first(); p != null; p = succ(p)) {
871 <            E item = p.item;
872 <            if (item != null && ITEM.compareAndSet(p, item, null)) {
871 >            final E item;
872 >            if ((item = p.item) != null
873 >                && ITEM.compareAndSet(p, item, null)) {
874                  unlink(p);
875                  return item;
876              }
# Line 879 | Line 880 | public class ConcurrentLinkedDeque<E>
880  
881      public E pollLast() {
882          for (Node<E> p = last(); p != null; p = pred(p)) {
883 <            E item = p.item;
884 <            if (item != null && ITEM.compareAndSet(p, item, null)) {
883 >            final E item;
884 >            if ((item = p.item) != null
885 >                && ITEM.compareAndSet(p, item, null)) {
886                  unlink(p);
887                  return item;
888              }
# Line 1013 | Line 1015 | public class ConcurrentLinkedDeque<E>
1015      public boolean contains(Object o) {
1016          if (o != null) {
1017              for (Node<E> p = first(); p != null; p = succ(p)) {
1018 <                E item = p.item;
1019 <                if (item != null && o.equals(item))
1018 >                final E item;
1019 >                if ((item = p.item) != null && o.equals(item))
1020                      return true;
1021              }
1022          }
# Line 1155 | Line 1157 | public class ConcurrentLinkedDeque<E>
1157              int charLength = 0;
1158              int size = 0;
1159              for (Node<E> p = first(); p != null;) {
1160 <                E item = p.item;
1161 <                if (item != null) {
1160 >                final E item;
1161 >                if ((item = p.item) != null) {
1162                      if (a == null)
1163                          a = new String[4];
1164                      else if (size == a.length)
# Line 1181 | Line 1183 | public class ConcurrentLinkedDeque<E>
1183          restartFromHead: for (;;) {
1184              int size = 0;
1185              for (Node<E> p = first(); p != null;) {
1186 <                E item = p.item;
1187 <                if (item != null) {
1186 >                final E item;
1187 >                if ((item = p.item) != null) {
1188                      if (x == null)
1189                          x = new Object[4];
1190                      else if (size == x.length)
# Line 1334 | Line 1336 | public class ConcurrentLinkedDeque<E>
1336                      nextItem = null;
1337                      break;
1338                  }
1339 <                E item = p.item;
1340 <                if (item != null) {
1339 >                final E item;
1340 >                if ((item = p.item) != null) {
1341                      nextNode = p;
1342                      nextItem = item;
1343                      break;
# Line 1494 | Line 1496 | public class ConcurrentLinkedDeque<E>
1496  
1497          // Write out all elements in the proper order.
1498          for (Node<E> p = first(); p != null; p = succ(p)) {
1499 <            E item = p.item;
1500 <            if (item != null)
1499 >            final E item;
1500 >            if ((item = p.item) != null)
1501                  s.writeObject(item);
1502          }
1503  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines