CHILDTYPE - The type of the children.public interface IHasChildren<CHILDTYPE>
| Modifier and Type | Method and Description |
|---|---|
default void |
forAllChildren(Consumer<? super CHILDTYPE> aConsumer)
Perform something on all children (if any).
|
default void |
forAllChildren(Predicate<? super CHILDTYPE> aFilter,
Consumer<? super CHILDTYPE> aConsumer)
Iterate all direct children (if at least one is present) and invoke the
provided consumer if the passed predicate is fulfilled.
|
default EContinue |
forAllChildrenBreakable(Function<? super CHILDTYPE,EContinue> aConsumer)
Perform something on all children (if any).
|
default <DSTTYPE> void |
forAllChildrenMapped(Predicate<? super CHILDTYPE> aFilter,
Function<? super CHILDTYPE,? extends DSTTYPE> aMapper,
Consumer<? super DSTTYPE> aConsumer)
Iterate all direct children (if at least one is present) and invoked the
provided consumer if the passed predicate is fulfilled.
|
ICommonsCollection<? extends CHILDTYPE> |
getAllChildren() |
int |
getChildCount() |
ICommonsIterable<? extends CHILDTYPE> |
getChildren() |
default boolean |
hasChildren() |
default boolean |
hasNoChildren() |
default boolean hasChildren()
true if this item has direct children,
false otherwise.default boolean hasNoChildren()
true if this item has no direct children,
false otherwise.@Nonnegative int getChildCount()
@Nullable @ReturnsMutableCopy ICommonsCollection<? extends CHILDTYPE> getAllChildren()
null
if no children are contained. This method should always return a
copy of the collection to avoid
ConcurrentModificationException when modifying
it.hasChildren(),
getChildren()@Nullable ICommonsIterable<? extends CHILDTYPE> getChildren()
null if
no children are contained. Compared to getAllChildren()
this method is not supposed to create a copy of the underlying
container but instead return the iterable only. Be careful when
using this method to modify a collection - it will lead to a
ConcurrentModificationException.hasChildren(),
getChildren()default void forAllChildren(@Nonnull Consumer<? super CHILDTYPE> aConsumer)
aConsumer - The consumer to be invoked. May not be null.@Nonnull default EContinue forAllChildrenBreakable(@Nonnull Function<? super CHILDTYPE,EContinue> aConsumer)
aConsumer - The breakable consumer to be invoked. May not be null.EContinue.BREAK if iteration was stopped,
EContinue.CONTINUE otherwise.default void forAllChildren(@Nonnull Predicate<? super CHILDTYPE> aFilter, @Nonnull Consumer<? super CHILDTYPE> aConsumer)
aFilter - The filter that is applied to all children. May not be
null.aConsumer - The consumer to be invoked for all children matching the filter. May
not be null.default <DSTTYPE> void forAllChildrenMapped(@Nonnull Predicate<? super CHILDTYPE> aFilter, @Nonnull Function<? super CHILDTYPE,? extends DSTTYPE> aMapper, @Nonnull Consumer<? super DSTTYPE> aConsumer)
DSTTYPE - The destination data type.aFilter - The filter that is applied to all children. May not be
null.aMapper - The mapping function from child type to the target type. May not be
null.aConsumer - The consumer to be invoked for all target types matching the filter.
May not be null.Copyright © 2014–2017 Philip Helger. All rights reserved.