package com.github.javachat.streems.guava;

import com.github.javachat.streems.Traversal;
import com.google.common.collect.TreeTraverser;

import java.util.function.Function;

public final class GuavaTraversal<E>
{
    private final TreeTraverser<E> traverser;

    public GuavaTraversal(final TreeTraverser<E> traverser)
    {
        this.traverser = traverser;
    }

    public Function<E, Iterable<E>> forTraversal(final Traversal traversal)
    {
        switch (traversal) {
            case BREADTHFIRST:
                return this::breadthfirst;
            case POSTORDER:
                return this::postorder;
            case PREORDER:
                return this::preorder;
        }
        throw new IllegalStateException("How did I even get there??");
    }

    public Iterable<E> preorder(final E root)
    {
        return traverser.preOrderTraversal(root);
    }

    public Iterable<E> postorder(final E root)
    {
        return traverser.postOrderTraversal(root);
    }

    public Iterable<E> breadthfirst(final E root)
    {
        return traverser.breadthFirstTraversal(root);
    }
}

@@ -768,37 +768,38 @@
 %22);%0A    %7D%0A%0A    p
-ublic
+rivate
  Iterable%3CE%3E pre
@@ -878,37 +878,38 @@
 t);%0A    %7D%0A%0A    p
-ublic
+rivate
  Iterable%3CE%3E pos
@@ -998,21 +998,22 @@
 %7D%0A%0A    p
-ublic
+rivate
  Iterabl

make traversal methods private