public MutableTree<K> beginWrite() {
        return new MutableTree<>(this);
    }
@Test
    public void iterationBenchmark() {
        final Persistent23Tree.MutableTree<Integer> tree = new Persistent23Tree<Integer>().beginWrite();
        final int count = 100000;
        for (int i = 0; i < count; ++i) {
            tree.add(i);
        }
        TestUtil.time("Persistent23Tree iteration", () -> {
            for (int i = 0; i < 300; ++i) {
                int prev = Integer.MIN_VALUE;
                Assert.assertFalse(tree.contains(prev));
                final Iterator<Integer> it = tree.iterator();
                int j = 0;
                while (it.hasNext()) {
                    j = it.next();
                    Assert.assertTrue(prev < j);
                    prev = j;
                }
                Assert.assertEquals(count - 1, j);
            }
        });
        TestUtil.time("Persistent23Tree reverse iteration", () -> {
            for (int i = 0; i < 300; ++i) {
                int prev = Integer.MAX_VALUE;
                Assert.assertFalse(tree.contains(prev));
                final Iterator<Integer> it = tree.reverseIterator();
                int j = 0;
                while (it.hasNext()) {
                    j = it.next();
                    Assert.assertTrue(prev > j);
                    prev = j;
                }
                Assert.assertEquals(0, j);
            }
        });
    }