org.solovyev.common.collections.tree.Tree Maven / Gradle / Ivy
package org.solovyev.common.collections.tree;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* User: serso
* Date: 4/1/12
* Time: 12:15 PM
*/
/**
* Class representing tree data structure.
* @param type of values stored in the tree nodes
*/
public interface Tree extends Iterable> {
/**
* @return root of the tree (one unique tree node without parent)
*/
@NotNull
TreeNode getRoot();
/**
* @return total number of elements in the tree
*/
int getSize();
/**
* NOTE: returned iterator which may support remove() BUT root cannot be removed in any case
* @return iterator which iterates over all elements in the tree
*/
@NotNull
@Override
TreeIterator iterator();
/**
* NOTE: returned iterator which may support remove() BUT root cannot be removed in any case
* @return iterator which iterates over all elements in the tree
*/
@NotNull
TreeIterator getIterator();
@NotNull
List extends TreeNode> getAllNodes();
}