Class TreeWithIDSearcher


  • @Immutable
    public final class TreeWithIDSearcher
    extends Object
    A utility class that helps searching items within trees.
    Author:
    Philip Helger
    • Method Detail

      • findAllItemsWithIDRecursive

        @Nonnull
        @ReturnsMutableCopy
        public static <KEYTYPE,​DATATYPE,​ITEMTYPE extends ITreeItemWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>> com.helger.commons.collection.impl.ICommonsList<ITEMTYPE> findAllItemsWithIDRecursive​(@Nonnull
                                                                                                                                                                                                                   IBasicTree<DATATYPE,​ITEMTYPE> aTree,
                                                                                                                                                                                                                   @Nullable
                                                                                                                                                                                                                   KEYTYPE aSearchID)
        Fill all items with the same ID by linearly scanning of the tree.
        Type Parameters:
        KEYTYPE - tree ID type
        DATATYPE - tree data type
        ITEMTYPE - tree item type
        Parameters:
        aTree - The tree to search. May not be null.
        aSearchID - The ID to search. May not be null.
        Returns:
        A non-null list with all matching items.
      • findAllItemsWithIDRecursive

        @Nonnull
        @ReturnsMutableCopy
        public static <KEYTYPE,​DATATYPE,​ITEMTYPE extends ITreeItemWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>> com.helger.commons.collection.impl.ICommonsList<ITEMTYPE> findAllItemsWithIDRecursive​(@Nonnull
                                                                                                                                                                                                                   ITEMTYPE aTreeItem,
                                                                                                                                                                                                                   @Nullable
                                                                                                                                                                                                                   KEYTYPE aSearchID)
        Fill all items with the same ID by linearly scanning the tree.
        Type Parameters:
        KEYTYPE - tree ID type
        DATATYPE - tree data type
        ITEMTYPE - tree item type
        Parameters:
        aTreeItem - The tree item to search. May not be null.
        aSearchID - The ID to search. May not be null.
        Returns:
        A non-null list with all matching items.