Class BasicTreeWithID<KEYTYPE,​DATATYPE,​ITEMTYPE extends ITreeItemWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>>

  • Type Parameters:
    KEYTYPE - tree item key type
    DATATYPE - tree item value type
    ITEMTYPE - tree item implementation type
    All Implemented Interfaces:
    com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>, IBasicTree<DATATYPE,​ITEMTYPE>, ITreeWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>
    Direct Known Subclasses:
    BasicTreeWithGlobalUniqueID, DefaultTreeWithID

    @NotThreadSafe
    public class BasicTreeWithID<KEYTYPE,​DATATYPE,​ITEMTYPE extends ITreeItemWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>>
    extends Object
    implements ITreeWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>
    Base class for a tree having items with IDs. This implementation is independent of the item implementation class. The elements of the tree are not sorted by any means.
    Author:
    Philip Helger
    • Method Detail

      • hasChildren

        public final boolean hasChildren()
        Specified by:
        hasChildren in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • getChildCount

        @Nonnegative
        public final int getChildCount()
        Specified by:
        getChildCount in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • getAllChildren

        @Nonnull
        @ReturnsMutableCopy
        public final com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE> getAllChildren()
        Specified by:
        getAllChildren in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • getChildren

        @Nonnull
        public final com.helger.commons.collection.impl.ICommonsIterable<ITEMTYPE> getChildren()
        Specified by:
        getChildren in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • forAllChildren

        public final void forAllChildren​(@Nonnull
                                         Consumer<? super ITEMTYPE> aConsumer)
        Specified by:
        forAllChildren in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • forAllChildrenBreakable

        @Nonnull
        public final com.helger.commons.state.EContinue forAllChildrenBreakable​(@Nonnull
                                                                                Function<? super ITEMTYPE,​com.helger.commons.state.EContinue> aConsumer)
        Specified by:
        forAllChildrenBreakable in interface com.helger.commons.hierarchy.IHasChildren<KEYTYPE>
      • getRootItem

        @Nonnull
        public final ITEMTYPE getRootItem()
        Specified by:
        getRootItem in interface IBasicTree<KEYTYPE,​DATATYPE>
        Returns:
        The root item of the tree. Never null. The root item should not be displayed but it is the parent node of all displayed root items and therefore cannot be removed.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object