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

Comparing jsr166/src/test/loops/ListBash.java (file contents):
Revision 1.6 by jsr166, Thu Oct 29 23:09:07 2009 UTC vs.
Revision 1.9 by jsr166, Mon Nov 2 23:55:36 2009 UTC

# Line 21 | Line 21 | public class ListBash {
21  
22          try {
23              cl = Class.forName(args[0]);
24 <        } catch(ClassNotFoundException e) {
24 >        } catch (ClassNotFoundException e) {
25              fail("Class " + args[0] + " not found.");
26          }
27  
# Line 152 | Line 152 | public class ListBash {
152              all = clone(s, cl, synch);
153          else {
154              it = even.iterator();
155 <            while(it.hasNext())
156 <                if((it.next()).intValue() % 2 == 1)
155 >            while (it.hasNext())
156 >                if ((it.next()).intValue() % 2 == 1)
157                      it.remove();
158              it = even.iterator();
159 <            while(it.hasNext())
160 <                if((it.next()).intValue() % 2 == 1)
159 >            while (it.hasNext())
160 >                if ((it.next()).intValue() % 2 == 1)
161                      fail("Failed to remove all odd nubmers.");
162  
163              for (int i=0; i<(listSize/2); i++)
164                  odd.remove(i);
165              for (int i=0; i<(listSize/2); i++) {
166                  int ii = (odd.get(i)).intValue();
167 <                if(ii % 2 != 1)
167 >                if (ii % 2 != 1)
168                      fail("Failed to remove all even nubmers. " + ii);
169              }
170  
# Line 189 | Line 189 | public class ListBash {
189              }
190              itAll = all.listIterator();
191              it = s.iterator();
192 <            while(it.hasNext())
193 <                if(it.next()==itAll.next())
192 >            while (it.hasNext())
193 >                if (it.next()==itAll.next())
194                      fail("Iterator.set failed to change value.");
195          }
196          if (!all.equals(s))
# Line 224 | Line 224 | public class ListBash {
224      static void arrays() {
225          List<Integer> l = newList(cl, synch);
226          AddRandoms(l, listSize);
227 <        Integer[] ia = (Integer[]) l.toArray(new Integer[0]);
227 >        Integer[] ia = l.toArray(new Integer[0]);
228          if (!l.equals(Arrays.asList(ia)))
229              fail("toArray(Object[]) is hosed (1)");
230          ia = new Integer[listSize];
231 <        Integer[] ib = (Integer[]) l.toArray(ia);
231 >        Integer[] ib = l.toArray(ia);
232          if (ia != ib || !l.equals(Arrays.asList(ia)))
233              fail("toArray(Object[]) is hosed (2)");
234          ia = new Integer[listSize+1];
235          ia[listSize] = new Integer(69);
236 <        ib = (Integer[]) l.toArray(ia);
236 >        ib = l.toArray(ia);
237          if (ia != ib || ia[listSize] != null
238              || !l.equals(Arrays.asList(ia).subList(0, listSize)))
239              fail("toArray(Object[]) is hosed (3)");
# Line 254 | Line 254 | public class ListBash {
254          if (!clone.containsAll(s))
255              fail("Copy does not contain list.");
256  
257 <        return (List<Integer>)clone;
257 >        return (List<Integer>) clone;
258      }
259  
260      static List<Integer> newList(Class cl, boolean synch) {
261          try {
262 <            List<Integer> s = (List<Integer>)cl.newInstance();
262 >            List<Integer> s = (List<Integer>) cl.newInstance();
263              if (synch)
264                  s = Collections.synchronizedList(s);
265              if (!s.isEmpty())
266                  fail("New instance non empty.");
267              return s;
268 <        } catch(Throwable t) {
268 >        } catch (Throwable t) {
269              fail("Can't instantiate " + cl + ": " + t);
270          }
271          return null; //Shut up compiler.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines