@Test
 public void testForEachWithIndexToArrayUsingArrayList() {
   Integer[] array = new Integer[200];
   List<Integer> list = new ArrayList<>(Interval.oneTo(200));
   Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull()));
   ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 10, 10);
   Assert.assertArrayEquals(array, list.toArray(new Integer[] {}));
 }
 @Test
 public void testForEachWithIndexToArrayUsingFixedArrayList() {
   Integer[] array = new Integer[10];
   List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
   Assert.assertTrue(ArrayIterate.allSatisfy(array, Predicates.isNull()));
   ParallelIterate.forEachWithIndex(list, (each, index) -> array[index] = each, 1, 2);
   Assert.assertArrayEquals(array, list.toArray(new Integer[list.size()]));
 }
Esempio n. 3
0
 @Override
 public boolean allSatisfy(Predicate<? super T> predicate) {
   return ArrayIterate.allSatisfy(this.items, predicate);
 }