@Test public void reverseForEach_emptyList() { ArrayList<Integer> integers = new ArrayList<Integer>(); MutableList<Integer> results = Lists.mutable.of(); ArrayListIterate.reverseForEach(integers, CollectionAddProcedure.on(results)); Assert.assertEquals(integers, results); }
@Test public void reverseForEach() { ArrayList<Integer> integers = Interval.oneTo(5).addAllTo(new ArrayList<Integer>()); MutableList<Integer> reverseResults = Lists.mutable.of(); ArrayListIterate.reverseForEach(integers, CollectionAddProcedure.on(reverseResults)); Assert.assertEquals(ListIterate.reverseThis(integers), reverseResults); }