void (Object[] expected, ArrayList collection) { Iterator iterator = FilteringIterator.create(collection.iterator(), STRINGS_ONLY); while (iterator.hasNext()) { if (iterator.next().equals("x")) iterator.remove(); } assertThat(collection).containsExactly(expected); }