ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collections/CheckedSetBash.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collections/CheckedSetBash.java (file contents):
Revision 1.6 by jsr166, Sun Oct 18 17:03:25 2015 UTC vs.
Revision 1.8 by jsr166, Sat Oct 21 00:59:54 2017 UTC

# Line 122 | Line 122 | public class CheckedSetBash {
122      }
123  
124      static void AddRandoms(Set s, int n) {
125 <        for (int i=0; i<n; i++) {
126 <            int r = rnd.nextInt() % n;
127 <            Integer e = new Integer(r < 0 ? -r : r);
125 >        for (int i = 0; i < n; i++) {
126 >            Integer e = rnd.nextInt(n);
127  
128              int preSize = s.size();
129              boolean prePresent = s.contains(e);
# Line 146 | Line 145 | public class CheckedSetBash {
145          ArrayList<Object[]> iters = new ArrayList<>(makeCheckedSets());
146          iters.ensureCapacity(numItr * iters.size());
147          for (int each=1; each < numItr; each++) {
148 <            iters.addAll( makeCheckedSets());
148 >            iters.addAll(makeCheckedSets());
149          }
150          return iters.iterator();
151      }
152  
153      public static Collection<Object[]> makeCheckedSets() {
154 <        return Arrays.asList(
155 <            new Object[]{"Collections.checkedSet(HashSet)",
156 <                (Supplier) () -> {return Collections.checkedSet(new HashSet(), Integer.class);}},
157 <            new Object[]{"Collections.checkedSet(TreeSet(reverseOrder))",
158 <                (Supplier) () -> {return Collections.checkedSet(new TreeSet(Collections.reverseOrder()), Integer.class);}},
159 <            new Object[]{"Collections.checkedSet(TreeSet.descendingSet())",
160 <                (Supplier) () -> {return Collections.checkedSet(new TreeSet().descendingSet(), Integer.class);}},
161 <            new Object[]{"Collections.checkedNavigableSet(TreeSet)",
162 <                (Supplier) () -> {return Collections.checkedNavigableSet(new TreeSet(), Integer.class);}},
163 <            new Object[]{"Collections.checkedNavigableSet(TreeSet(reverseOrder))",
164 <                (Supplier) () -> {return Collections.checkedNavigableSet(new TreeSet(Collections.reverseOrder()), Integer.class);}},
165 <            new Object[]{"Collections.checkedNavigableSet(TreeSet.descendingSet())",
166 <                (Supplier) () -> {return Collections.checkedNavigableSet(new TreeSet().descendingSet(), Integer.class);}}
167 <            );
154 >        Object[][] params = {
155 >            {"Collections.checkedSet(HashSet)",
156 >             (Supplier) () -> Collections.checkedSet(new HashSet(), Integer.class)},
157 >            {"Collections.checkedSet(TreeSet(reverseOrder))",
158 >             (Supplier) () -> Collections.checkedSet(new TreeSet(Collections.reverseOrder()), Integer.class)},
159 >            {"Collections.checkedSet(TreeSet.descendingSet())",
160 >             (Supplier) () -> Collections.checkedSet(new TreeSet().descendingSet(), Integer.class)},
161 >            {"Collections.checkedNavigableSet(TreeSet)",
162 >             (Supplier) () -> Collections.checkedNavigableSet(new TreeSet(), Integer.class)},
163 >            {"Collections.checkedNavigableSet(TreeSet(reverseOrder))",
164 >             (Supplier) () -> Collections.checkedNavigableSet(new TreeSet(Collections.reverseOrder()), Integer.class)},
165 >            {"Collections.checkedNavigableSet(TreeSet.descendingSet())",
166 >             (Supplier) () -> Collections.checkedNavigableSet(new TreeSet().descendingSet(), Integer.class)},
167 >        };
168 >        return Arrays.asList(params);
169      }
170   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines