Last active
June 16, 2021 07:01
-
-
Save hochgi/e9943877cc025b41416f580a10ecd67a to your computer and use it in GitHub Desktop.
Tree parsing exercise java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scratch.example; | |
import java.util.List; | |
public class Tree { | |
int value; | |
List<Tree> children; | |
public Tree(int value, List<Tree> children) { | |
this.value = value; | |
this.children = children; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scratch.example; | |
import java.util.Optional; | |
public interface TreeFormatter { | |
String format(Tree tree); | |
Optional<Tree> parse(String in); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment