test/java/util/Spliterator/SpliteratorCollisions.java

Print this page
rev 7629 : 8015320: Pull spliterator() up from Collection to Iterable
Reviewed-by: psandoz
Contributed-by: brian.goetz@oracle.com
* * *
Promote part of implNote to implSpec
rev 7633 : 8017513: Support for closeable streams
Reviewed-by:
Contributed-by: brian.goetz@oracle.com


 131 
 132             // Collections that use HashMap
 133             db.addCollection(HashSet::new);
 134             db.addCollection(LinkedHashSet::new);
 135             db.addCollection(TreeSet::new);
 136         }
 137         return spliteratorDataProvider = data.toArray(new Object[0][]);
 138     }
 139 
 140     static Object[][] spliteratorDataProviderWithNull;
 141 
 142     @DataProvider(name = "HashableIntSpliteratorWithNull")
 143     public static Object[][] spliteratorNullDataProvider() {
 144         if (spliteratorDataProviderWithNull != null) {
 145             return spliteratorDataProviderWithNull;
 146         }
 147 
 148         List<Object[]> data = new ArrayList<>();
 149         for (int size : SIZES) {
 150             List<HashableInteger> exp = listIntRange(size, true);
 151             exp.add(0, null);
 152             SpliteratorDataBuilder<HashableInteger> db = new SpliteratorDataBuilder<>(data, exp);
 153 
 154             // Maps
 155             db.addMap(HashMap::new);
 156             db.addMap(LinkedHashMap::new);
 157             // TODO: add this back in if we decide to keep TreeBin in WeakHashMap
 158             //db.addMap(WeakHashMap::new);
 159 
 160             // Collections that use HashMap
 161             db.addCollection(HashSet::new);
 162             db.addCollection(LinkedHashSet::new);
 163 //            db.addCollection(TreeSet::new);
 164 
 165         }
 166         return spliteratorDataProviderWithNull = data.toArray(new Object[0][]);
 167     }
 168 
 169     final static class HashableInteger implements Comparable<HashableInteger> {
 170 
 171         final int value;




 131 
 132             // Collections that use HashMap
 133             db.addCollection(HashSet::new);
 134             db.addCollection(LinkedHashSet::new);
 135             db.addCollection(TreeSet::new);
 136         }
 137         return spliteratorDataProvider = data.toArray(new Object[0][]);
 138     }
 139 
 140     static Object[][] spliteratorDataProviderWithNull;
 141 
 142     @DataProvider(name = "HashableIntSpliteratorWithNull")
 143     public static Object[][] spliteratorNullDataProvider() {
 144         if (spliteratorDataProviderWithNull != null) {
 145             return spliteratorDataProviderWithNull;
 146         }
 147 
 148         List<Object[]> data = new ArrayList<>();
 149         for (int size : SIZES) {
 150             List<HashableInteger> exp = listIntRange(size, true);

 151             SpliteratorDataBuilder<HashableInteger> db = new SpliteratorDataBuilder<>(data, exp);
 152 
 153             // Maps
 154             db.addMap(HashMap::new);
 155             db.addMap(LinkedHashMap::new);
 156             // TODO: add this back in if we decide to keep TreeBin in WeakHashMap
 157             //db.addMap(WeakHashMap::new);
 158 
 159             // Collections that use HashMap
 160             db.addCollection(HashSet::new);
 161             db.addCollection(LinkedHashSet::new);
 162 //            db.addCollection(TreeSet::new);
 163 
 164         }
 165         return spliteratorDataProviderWithNull = data.toArray(new Object[0][]);
 166     }
 167 
 168     final static class HashableInteger implements Comparable<HashableInteger> {
 169 
 170         final int value;