void () { HashMap<Integer, Collection<Integer>> map1 = new HashMap<>(numbers()); JBTreeTraverser<Integer> traverser = JBTreeTraverser.from(Functions.compose(ASSERT_NUMBER, a -> map1.remove(a))).withRoot(1); JBTreeTraverser<Integer> cached = traverser.cached(); assertEquals(Arrays.asList(1, 2, 5, 6, 7, 3, 8, 9, 10, 4, 11, 12, 13), cached.toList()); assertEquals(cached.toList(), cached.toList()); assertEquals(Arrays.asList(1), traverser.toList()); }