[cvs] / jsr166 / src / test / tck / LinkedListTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/LinkedListTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26, Tue Mar 15 19:47:06 2011 UTC revision 1.30, Tue Feb 21 01:54:04 2012 UTC
# Line 7  Line 7 
7   */   */
8    
9  import junit.framework.*;  import junit.framework.*;
10  import java.util.*;  import java.util.Arrays;
11  import java.util.concurrent.*;  import java.util.Collection;
12    import java.util.Iterator;
13    import java.util.LinkedList;
14    import java.util.NoSuchElementException;
15    
16  public class LinkedListTest extends JSR166TestCase {  public class LinkedListTest extends JSR166TestCase {
17      public static void main(String[] args) {      public static void main(String[] args) {
# Line 20  Line 23 
23      }      }
24    
25      /**      /**
26       * Create a queue of given size containing consecutive       * Creates a queue of given size containing consecutive
27       * Integers 0 ... n.       * Integers 0 ... n.
28       */       */
29      private LinkedList<Integer> populatedQueue(int n) {      private LinkedList<Integer> populatedQueue(int n) {
# Line 408  Line 411 
411          q.add(new Integer(2));          q.add(new Integer(2));
412          q.add(new Integer(3));          q.add(new Integer(3));
413          Iterator it = q.iterator();          Iterator it = q.iterator();
414          assertEquals(it.next(), 1);          assertEquals(1, it.next());
415          it.remove();          it.remove();
416          it = q.iterator();          it = q.iterator();
417          assertEquals(it.next(), 2);          assertEquals(2, it.next());
418          assertEquals(it.next(), 3);          assertEquals(3, it.next());
419          assertFalse(it.hasNext());          assertFalse(it.hasNext());
420      }      }
421    
# Line 468  Line 471 
471          assertFalse(it.hasNext());          assertFalse(it.hasNext());
472      }      }
473    
   
474      /**      /**
475       * toString contains toStrings of elements       * toString contains toStrings of elements
476       */       */
# Line 476  Line 478 
478          LinkedList q = populatedQueue(SIZE);          LinkedList q = populatedQueue(SIZE);
479          String s = q.toString();          String s = q.toString();
480          for (int i = 0; i < SIZE; ++i) {          for (int i = 0; i < SIZE; ++i) {
481              assertTrue(s.indexOf(String.valueOf(i)) >= 0);              assertTrue(s.contains(String.valueOf(i)));
482          }          }
483      }      }
484    
# Line 555  Line 557 
557          assertNull(q.peekFirst());          assertNull(q.peekFirst());
558      }      }
559    
   
560      /**      /**
561       * peekLast returns next element, or null if empty       * peekLast returns next element, or null if empty
562       */       */

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.30

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8