TreeTraversal (final @NotNull GuidedIt.Guide<?> guide) { return new TreeTraversal("GUIDED_TRAVERSAL") { @Override public @NotNull <T> It<T> createIterator(@NotNull Iterable<? extends T> roots, @NotNull Function<? super T, ? extends Iterable<? extends T>> tree) { //noinspection unchecked return new GuidedItImpl<>(roots, tree, (GuidedIt.Guide<T>)guide); } }; }