@Test public void testForEachWith() { MutableList<String> result = Lists.mutable.of(); MutableList<String> source = Lists.fixedSize.of("1", "2", "3", "4", "5", "6"); source.forEachWith(Procedures2.fromProcedure(CollectionAddProcedure.on(result)), null); Assert.assertEquals(FastList.newListWith("1", "2", "3", "4", "5", "6"), result); }
@Override @Test public void forEachKey() { MutableList<Integer> collection = Lists.mutable.of(); MutableMap<Integer, String> map = new SingletonMap<Integer, String>(1, "1"); map.forEachKey(CollectionAddProcedure.on(collection)); Assert.assertEquals(FastList.newListWith(1), collection); }