summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcdata
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java
index 47acf1a..014c298 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IList.java
@@ -28,6 +28,10 @@ public interface IList<ContainedType> {
*/
boolean add(ContainedType item);
+ default boolean addAll(IList<ContainedType> items) {
+ return items.map(this::add).anyMatch((bl) -> bl == false);
+ }
+
/**
* Check if all of the elements of this list match the specified
* predicate.
@@ -62,8 +66,8 @@ public interface IList<ContainedType> {
*/
public default <StateType, ReducedType> ReducedType collect(
Collector<ContainedType, StateType, ReducedType> collector) {
- BiConsumer<StateType,
- ContainedType> accumulator = collector.accumulator();
+ BiConsumer<StateType, ContainedType> accumulator = collector
+ .accumulator();
return reduceAux(collector.supplier().get(), (value, state) -> {
accumulator.accept(state, value);
@@ -92,8 +96,8 @@ public interface IList<ContainedType> {
* @return A new list containing the merged pairs of lists.
*/
<OtherType, CombinedType> IList<CombinedType> combineWith(
- IList<OtherType> rightList, BiFunction<ContainedType,
- OtherType, CombinedType> itemCombiner);
+ IList<OtherType> rightList,
+ BiFunction<ContainedType, OtherType, CombinedType> itemCombiner);
/**
* Check if the list contains the specified item
@@ -261,8 +265,7 @@ public interface IList<ContainedType> {
* its final state.
*/
<StateType, ReducedType> ReducedType reduceAux(StateType initialValue,
- BiFunction<ContainedType, StateType,
- StateType> stateAccumulator,
+ BiFunction<ContainedType, StateType, StateType> stateAccumulator,
Function<StateType, ReducedType> resultTransformer);
/**