Interface IHasChildrenSorted<CHILDTYPE>

Type Parameters:
CHILDTYPE - The type of the children.
All Superinterfaces:
IHasChildren<CHILDTYPE>

public interface IHasChildrenSorted<CHILDTYPE> extends IHasChildren<CHILDTYPE>
Extends IHasChildren by indicating that the child items are sorted!
Author:
Philip Helger
  • Method Details

    • getAllChildren

      @Nullable ICommonsList<? extends CHILDTYPE> getAllChildren()
      Specified by:
      getAllChildren in interface IHasChildren<CHILDTYPE>
      Returns:
      A ordered list of child elements. May be null if no children are present.
      See Also:
    • getChildAtIndex

      @Nullable CHILDTYPE getChildAtIndex(@Nonnegative int nIndex)
      Get the child node at the specified index
      Parameters:
      nIndex - The index to be queried. May not be < 0 or ≥ the number of children
      Returns:
      The child at the specified index or null if the index is invalid.
      Throws:
      IndexOutOfBoundsException - in case the index is invalid
    • getFirstChild

      @Nullable default CHILDTYPE getFirstChild()
      Get the first child node or null if no child is present
      Returns:
      The first child or null.
    • findFirstChild

      @Nullable default CHILDTYPE findFirstChild(@Nonnull Predicate<? super CHILDTYPE> aFilter)
      Find the first direct child that matches the passed predicate.
      Parameters:
      aFilter - The filter that is applied on each direct child node. May not be null.
      Returns:
      null if no direct child matches the passed filter or if no child is present at all.
    • findFirstChildMapped

      @Nullable default <DSTTYPE> DSTTYPE findFirstChildMapped(@Nonnull Predicate<? super CHILDTYPE> aFilter, @Nonnull Function<? super CHILDTYPE,? extends DSTTYPE> aMapper)
      Find the first direct child that matches the passed predicate.
      Type Parameters:
      DSTTYPE - The destination type to be mapped to
      Parameters:
      aFilter - The filter that is applied on each direct child node. May not be null.
      aMapper - The mapping function from micro node to the target type. May not be null.
      Returns:
      null if no direct child matches the passed filter or if no child is present at all.
    • getLastChild

      @Nullable default CHILDTYPE getLastChild()
      Get the last child node or null if no child is present
      Returns:
      The last child or null.