All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.solovyev.common.collections.tree.Tree Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
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> getAllNodes();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy