Package com.helger.commons.hierarchy
Interface IHasChildrenSorted<CHILDTYPE>
- Type Parameters:
CHILDTYPE- The type of the children.
- All Superinterfaces:
IHasChildren<CHILDTYPE>
Extends
IHasChildren by indicating that the child items are sorted!- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiondefault CHILDTYPEfindFirstChild(Predicate<? super CHILDTYPE> aFilter) Find the first direct child that matches the passed predicate.default <DSTTYPE> DSTTYPEfindFirstChildMapped(Predicate<? super CHILDTYPE> aFilter, Function<? super CHILDTYPE, ? extends DSTTYPE> aMapper) Find the first direct child that matches the passed predicate.ICommonsList<? extends CHILDTYPE> getChildAtIndex(int nIndex) Get the child node at the specified indexdefault CHILDTYPEGet the first child node ornullif no child is presentdefault CHILDTYPEGet the last child node ornullif no child is presentMethods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
-
Method Details
-
getAllChildren
- Specified by:
getAllChildrenin interfaceIHasChildren<CHILDTYPE>- Returns:
- A ordered list of child elements. May be
nullif no children are present. - See Also:
-
getChildAtIndex
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
nullif the index is invalid. - Throws:
IndexOutOfBoundsException- in case the index is invalid
-
getFirstChild
Get the first child node ornullif no child is present- Returns:
- The first child or
null.
-
findFirstChild
Find the first direct child that matches the passed predicate.- Parameters:
aFilter- The filter that is applied on each direct child node. May not benull.- Returns:
nullif 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 benull.aMapper- The mapping function from micro node to the target type. May not benull.- Returns:
nullif no direct child matches the passed filter or if no child is present at all.
-
getLastChild
Get the last child node ornullif no child is present- Returns:
- The last child or
null.
-