ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/IteratorLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/IteratorLoops.java (file contents):
Revision 1.11 by jsr166, Thu Dec 18 18:43:22 2014 UTC vs.
Revision 1.14 by jsr166, Sun Oct 23 03:03:23 2016 UTC

# Line 32 | Line 32 | public final class IteratorLoops {
32          System.out.println();
33  
34          Collection<Integer>[] colls =
35 <            (Collection<Integer>[])new Collection[NC];
35 >            (Collection<Integer>[])new Collection<?>[NC];
36  
37          for (int k = 0; k < colls.length; ++k) {
38 <            Object x = klass.newInstance();
38 >            Object x = klass.getConstructor().newInstance();
39              if (x instanceof Collection)
40                  colls[k] = (Collection<Integer>) x;
41              else if (x instanceof Map)
# Line 86 | Line 86 | public final class IteratorLoops {
86      int counts() {
87          int count = 0;
88          for (int k = 0; k < cs.length; ++k) {
89 <            for (Iterator it = cs[k].iterator(); it.hasNext();) {
90 <                if (it.next() != null)
89 >            for (Integer x : cs[k]) {
90 >                if (x != null)
91                      ++count;
92              }
93          }
# Line 122 | Line 122 | public final class IteratorLoops {
122          try { Thread.sleep(500); }
123          catch (Exception ex) { return; }
124      }
125
126
125   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines