< prev index next >

test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -44,10 +44,11 @@
     private static final Integer[] ones = new Integer[100];
     private static final Integer[] twice = new Integer[200];
     private static final Integer[] pseudoRandom;
 
     private static final Object[][] testData;
+    private static final Object[][] testSmallData;
     private static final Object[][] withNullTestData;
     private static final Object[][] spliteratorTestData;
 
     static {
         Integer[][] arrays = {to0, to1, to10, to100, to1000};

@@ -82,16 +83,20 @@
             {"pseudorandom", pseudoRandom}
     };
 
     static {
         {
-            List<Object[]> list = new ArrayList<>();
+            List<Object[]> listSmall = new ArrayList<>();
+            List<Object[]> list1000 = new ArrayList<>();
+            List<Object[]> list = null;
             for (Object[] data : arrays) {
                 final Object name = data[0];
                 final Integer[] ints = (Integer[])data[1];
                 final List<Integer> intsAsList = Arrays.asList(ints);
 
+                list = ints.length >= 1000 ? list1000 : listSmall;
+
                 list.add(arrayDataDescr("array:" + name, ints));
                 list.add(collectionDataDescr("ArrayList.asList:" + name, intsAsList));
                 list.add(collectionDataDescr("ArrayList:" + name, new ArrayList<>(intsAsList)));
                 list.add(streamDataDescr("DelegatingStream(ArrayList):" + name,
                                          () -> new ArrayList<>(intsAsList).stream()));

@@ -112,11 +117,13 @@
                 intsAsList.forEach(spinedBuffer);
                 list.add(sbDataDescr("SpinedBuffer:" + name, spinedBuffer));
 
                 // @@@ Add more
             }
-            testData = list.toArray(new Object[0][]);
+            testSmallData = listSmall.toArray(new Object[0][]);
+            list1000.addAll(listSmall);
+            testData = list1000.toArray(new Object[0][]);
         }
 
         // Simple combination of numbers and null values, probably excessive but may catch
         // errors for initialization/termination/sequence
         // @@@ This is separate from the other data for now until nulls are consistently supported by

@@ -190,10 +197,15 @@
     @DataProvider(name = "StreamTestData<Integer>")
     public static Object[][] makeStreamTestData() {
         return testData;
     }
 
+    @DataProvider(name = "StreamTestData<Integer>.small")
+    public static Object[][] makeSmallStreamTestData() {
+        return testSmallData;
+    }
+
     @DataProvider(name = "withNull:StreamTestData<Integer>")
     public static Object[][] makeStreamWithNullTestData() {
         return withNullTestData;
     }
 
< prev index next >