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

Comparing jsr166/src/test/tck/LinkedListTest.java (file contents):
Revision 1.46 by jsr166, Sat Mar 11 18:20:47 2017 UTC vs.
Revision 1.47 by jsr166, Tue Apr 3 05:49:43 2018 UTC

# Line 10 | Line 10 | import java.util.Arrays;
10   import java.util.Collection;
11   import java.util.Iterator;
12   import java.util.LinkedList;
13 + import java.util.List;
14   import java.util.NoSuchElementException;
15 + import java.util.concurrent.ThreadLocalRandom;
16  
17   import junit.framework.Test;
18  
# Line 22 | Line 24 | public class LinkedListTest extends JSR1
24      public static Test suite() {
25          class Implementation implements CollectionImplementation {
26              public Class<?> klazz() { return LinkedList.class; }
27 <            public Collection emptyCollection() { return new LinkedList(); }
27 >            public List emptyCollection() { return new LinkedList(); }
28              public Object makeElement(int i) { return i; }
29              public boolean isConcurrent() { return false; }
30              public boolean permitsNulls() { return true; }
31          }
32          class SubListImplementation extends Implementation {
33 <            public Collection emptyCollection() {
34 <                return new LinkedList().subList(0, 0);
33 >            public List emptyCollection() {
34 >                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(

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines