Package com.helger.commons.hierarchy
Interface IHasChildrenSorted<CHILDTYPE>
-
- Type Parameters:
CHILDTYPE- The type of the children.
- All Superinterfaces:
IHasChildren<CHILDTYPE>
public interface IHasChildrenSorted<CHILDTYPE> extends IHasChildren<CHILDTYPE>
ExtendsIHasChildrenby indicating that the child items are sorted!- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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>getAllChildren()CHILDTYPEgetChildAtIndex(int nIndex)Get the child node at the specified indexdefault CHILDTYPEgetFirstChild()Get the first child node ornullif no child is presentdefault CHILDTYPEgetLastChild()Get the last child node ornullif no child is present-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
-
-
-
-
Method Detail
-
getAllChildren
@Nullable ICommonsList<? extends CHILDTYPE> getAllChildren()
- Specified by:
getAllChildrenin interfaceIHasChildren<CHILDTYPE>- Returns:
- A ordered list of child elements. May be
nullif no children are present. - See Also:
IHasChildren.hasChildren(),IHasChildren.getChildren()
-
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
nullif the index is invalid. - Throws:
IndexOutOfBoundsException- in case the index is invalid
-
getFirstChild
@Nullable default CHILDTYPE getFirstChild()
Get the first child node ornullif 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 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.
-
-