Tree implements Serializable { @Override public int hashCode() { return this.toString().hashCode(); } Tree();  Tree(T label); void addSubtreeAt(Tree<T> tree, T edgeLabel, int position); void addSubtreeAt(Tree<T> tree, int position); void addSubtree(Tree<T> tree, T edgeLabel); void addSubtree(Tree<T> tree); void addSubtrees(Iterable<Tree<T>> subtrees, Iterable<T> edgeLabels); void addSubtrees(Iterable<Tree<T>> subtrees); void addLeaf(T leafLabel, T edgeLabel); void addLeaf(T leafLabel); static Tree<String> readTreeFromString(String treeString); Tree<T> getChild(int position); T getLabel(); Iterable<Tree<T>> childrenIterator(); Iterable<T> childrenEdgeLabelIterator(); List<Tree<T>> getChildren(); List<T> getChildrenEdgeLabels(); T getEdgeLabel(int childId); int size(); List<Tree<T>> getYield(); boolean isLeaf(); int getNumberOfChildren(); Tree<T> getParent(); boolean isRoot(); int getHeight(); int getPositionAmongParentsChildren(); @Override String toString(); @SuppressWarnings("unchecked") @Override Object clone(); @SuppressWarnings("unchecked") @Override boolean equals(Object obj); @Override int hashCode(); void removeChildAt(int position); boolean hasEdgeLabels();  }
@Test public final void testHashCode() { Tree<String> t = (new TreeParser<>(new INodeReader<String>() { public String parseNode(String string) { return string; } })).parse(treeString); assertEquals(tree.hashCode(), t.hashCode()); }