Interface IHCHasChildrenMutable<IMPLTYPE extends IHCHasChildrenMutable<IMPLTYPE,​CHILDTYPE>,​CHILDTYPE extends IHCNode>

    • Method Detail

      • addChild

        @Nonnull
        IMPLTYPE addChild​(@Nullable
                          CHILDTYPE aNode)
        Add a new child.
        Parameters:
        aNode - Child to add. May be null in which case nothing happens.
        Returns:
        this
      • setChild

        @Nonnull
        default IMPLTYPE setChild​(@Nullable
                                  CHILDTYPE aNode)
        Remove all existing children and only set the new child.
        Parameters:
        aNode - Child to add. May be null in which case the elements stays empty.
        Returns:
        this
      • addChildAt

        @Nonnull
        IMPLTYPE addChildAt​(@Nonnegative
                            int nIndex,
                            @Nullable
                            CHILDTYPE aNode)
        Parameters:
        nIndex - The index to where the element should be inserted.
        aNode - Child to add. May be null in which case nothing happens.
        Returns:
        this
      • addChildren

        @Nonnull
        default IMPLTYPE addChildren​(@Nullable
                                     CHILDTYPE... aChildren)
        Parameters:
        aChildren - Children to add. May be null in which case nothing happens.
        Returns:
        this
      • addChildrenAt

        @Nonnull
        default IMPLTYPE addChildrenAt​(@Nonnegative
                                       int nIndex,
                                       @Nullable
                                       CHILDTYPE... aChildren)
        Parameters:
        nIndex - The index to where the elements should be inserted.
        aChildren - Children to add. May be null in which case nothing happens.
        Returns:
        this
      • addChildrenAt

        @Nonnull
        default IMPLTYPE addChildrenAt​(@Nonnegative
                                       int nIndex,
                                       @Nullable
                                       Iterable<? extends CHILDTYPE> aChildren)
        Parameters:
        nIndex - The index to where the elements should be inserted.
        aChildren - Children to add. May be null in which case nothing happens.
        Returns:
        this
      • addAndReturnChild

        @Nullable
        @CheckReturnValue
        default <V extends CHILDTYPE> V addAndReturnChild​(@Nullable
                                                          V aChild)
        Type Parameters:
        V - The type to add. Needs to be a IHCNode or a sub class.
        Parameters:
        aChild - Child to add. May be null in which case nothing happens.
        Returns:
        the added child. May be null.
      • addAndReturnChildAt

        @Nullable
        @CheckReturnValue
        default <V extends CHILDTYPE> V addAndReturnChildAt​(@Nonnegative
                                                            int nIndex,
                                                            @Nullable
                                                            V aChild)
        Type Parameters:
        V - The type to add. Needs to be a IHCNode or a sub class.
        Parameters:
        nIndex - The index where the element should be added. Always ≥ 0.
        aChild - Child to add. May be null in which case nothing happens.
        Returns:
        the added child. May be null.
      • removeChildAt

        @Nonnull
        IMPLTYPE removeChildAt​(@Nonnegative
                               int nIndex)
        Remove the child at the specified index.
        Parameters:
        nIndex - The index to use. Must be ≥ 0.
        Returns:
        this for chaining
      • removeChild

        @Nonnull
        IMPLTYPE removeChild​(@Nullable
                             CHILDTYPE aNode)
        Remove the passed direct child object.
        Parameters:
        aNode - The node to be removed. May be null in which case nothing happens.
        Returns:
        this for chaining
      • removeAllChildren

        @Nonnull
        IMPLTYPE removeAllChildren()
        Remove all children of this object.
        Returns:
        this for chaining
      • sortAllChildren

        @Nonnull
        IMPLTYPE sortAllChildren​(@Nonnull
                                 Comparator<? super CHILDTYPE> aComparator)
        Sort all children with the passed comparator
        Parameters:
        aComparator - The comparator to be used. May not be null.
        Returns:
        this for chaining
      • getAllChildrenAsNodeList

        @Nonnull
        IHCNodeList<?> getAllChildrenAsNodeList()
        Returns:
        A new node list with all contained children. Never null but maybe empty.