[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.45, Sat Mar 11 17:33:32 2017 UTC revision 1.47, Tue Apr 3 05:49:43 2018 UTC
# Line 10  Line 10 
10  import java.util.Collection;  import java.util.Collection;
11  import java.util.Iterator;  import java.util.Iterator;
12  import java.util.LinkedList;  import java.util.LinkedList;
13    import java.util.List;
14  import java.util.NoSuchElementException;  import java.util.NoSuchElementException;
15    import java.util.concurrent.ThreadLocalRandom;
16    
17  import junit.framework.Test;  import junit.framework.Test;
18    
# Line 22  Line 24 
24      public static Test suite() {      public static Test suite() {
25          class Implementation implements CollectionImplementation {          class Implementation implements CollectionImplementation {
26              public Class<?> klazz() { return LinkedList.class; }              public Class<?> klazz() { return LinkedList.class; }
27              public Collection emptyCollection() { return new LinkedList(); }              public List emptyCollection() { return new LinkedList(); }
28              public Object makeElement(int i) { return i; }              public Object makeElement(int i) { return i; }
29              public boolean isConcurrent() { return false; }              public boolean isConcurrent() { return false; }
30              public boolean permitsNulls() { return true; }              public boolean permitsNulls() { return true; }
31          }          }
32          class SubListImplementation extends Implementation {          class SubListImplementation extends Implementation {
33              public Collection emptyCollection() {              public List emptyCollection() {
34                  return new LinkedList().subList(0, 0);                  List list = super.emptyCollection();
35                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
36                    if (rnd.nextBoolean())
37                        list.add(makeElement(rnd.nextInt()));
38                    int i = rnd.nextInt(list.size() + 1);
39                    return list.subList(i, i);
40              }              }
41          }          }
42          return newTestSuite(          return newTestSuite(
# Line 42  Line 49 
49       * Returns a new queue of given size containing consecutive       * Returns a new queue of given size containing consecutive
50       * Integers 0 ... n - 1.       * Integers 0 ... n - 1.
51       */       */
52      private LinkedList<Integer> populatedQueue(int n) {      private static LinkedList<Integer> populatedQueue(int n) {
53          LinkedList<Integer> q = new LinkedList<>();          LinkedList<Integer> q = new LinkedList<>();
54          assertTrue(q.isEmpty());          assertTrue(q.isEmpty());
55          for (int i = 0; i < n; ++i)          for (int i = 0; i < n; ++i)

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.47

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8