Module xyz.ronella.casual.trivial
Package xyz.ronella.trivial.decorator
Class ListAdder<TYPE_ELEMENT>
java.lang.Object
xyz.ronella.trivial.decorator.ListAdder<TYPE_ELEMENT>
- Type Parameters:
TYPE_ELEMENT- The type of object that the list will hold.
A class the wraps a List to have add methods with condition.
- Since:
- 2.10.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, Supplier<TYPE_ELEMENT> generateElement) Add element to a specific index of the wrapped list.voidadd(int index, TYPE_ELEMENT element) Add element to a specific index of the wrapped list.voidadd(BooleanSupplier when, int index, Supplier<TYPE_ELEMENT> generateElement) Add element to a specific index of the wrapped list.voidadd(BooleanSupplier when, int index, TYPE_ELEMENT element) Add element to a specific index of the wrapped list.booleanadd(BooleanSupplier when, Supplier<TYPE_ELEMENT> generateElement) Add element to a wrapped list.booleanadd(BooleanSupplier when, TYPE_ELEMENT element) Add element to a wrapped list.booleanadd(Supplier<TYPE_ELEMENT> generateElement) Add element to a wrapped list.booleanadd(TYPE_ELEMENT element) Add element to a wrapped list.booleanaddAll(int index, Collection<? extends TYPE_ELEMENT> elements) Add elements to a specified index of the wrapped list.booleanaddAll(int index, Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a specified index of the wrapped list.booleanaddAll(Collection<? extends TYPE_ELEMENT> elements) Add elements to a wrapped list.booleanaddAll(BooleanSupplier when, int index, Collection<? extends TYPE_ELEMENT> elements) Add elements to a specified index of the wrapped list.booleanaddAll(BooleanSupplier when, int index, Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a specified index of the wrapped list.booleanaddAll(BooleanSupplier when, Collection<? extends TYPE_ELEMENT> elements) Add elements to a wrapped list.booleanaddAll(BooleanSupplier when, Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a wrapped list.booleanaddAll(Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a wrapped list.
-
Constructor Details
-
ListAdder
Creates an instance of ListAdder- Parameters:
list- An instance of List to wrap.
-
-
Method Details
-
add
Add element to a wrapped list.- Parameters:
when- The logic that must return true to add the element.element- Specified in List.add- Returns:
- Specified in List.add
-
add
Add element to a wrapped list.- Parameters:
when- The logic that must return true to add the element.generateElement- The logic that will generate the element.- Returns:
- Specified in List.add
-
add
Add element to a wrapped list. Added for convenience.- Parameters:
element- Specified in List.add- Returns:
- Specified in List.add
-
add
Add element to a wrapped list.- Parameters:
generateElement- The logic that will generate the element.- Returns:
- Specified in List.add
-
addAll
Add elements to a wrapped list.- Parameters:
when- The logic that must return true to add the elements.elements- Specified in List.addAll- Returns:
- Specified in List.addAll
-
addAll
public boolean addAll(BooleanSupplier when, Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a wrapped list.- Parameters:
when- The logic that must return true to add the elements.generateElements- The logic that will generate the elements.- Returns:
- Specified in List.addAll
-
addAll
Add elements to a wrapped list. Added for convenience.- Parameters:
elements- Specified in List.addAll- Returns:
- Specified in List.addAll
-
addAll
Add elements to a wrapped list.- Parameters:
generateElements- The logic that will generate the elements.- Returns:
- Specified in List.addAll
-
add
Add element to a specific index of the wrapped list.- Parameters:
when- The logic that must return true to add the element.index- Specified in List.addelement- Specified in List.add
-
add
Add element to a specific index of the wrapped list.- Parameters:
when- The logic that must return true to add the element.index- Specified in List.addgenerateElement- The logic that will generate the element.
-
add
Add element to a specific index of the wrapped list. Added for convenience.- Parameters:
index- Specified in List.addelement- Specified in List.add
-
add
Add element to a specific index of the wrapped list.- Parameters:
index- Specified in List.addgenerateElement- The logic that will generate the element.
-
addAll
Add elements to a specified index of the wrapped list.- Parameters:
when- The logic that must return true to add the elements.index- Specified in List.addelements- Specified in List.add- Returns:
- Specified in List.addAll
-
addAll
public boolean addAll(BooleanSupplier when, int index, Supplier<Collection<? extends TYPE_ELEMENT>> generateElements) Add elements to a specified index of the wrapped list.- Parameters:
when- The logic that must return true to add the elements.index- Specified in List.addgenerateElements- The logic that will generate the elements.- Returns:
- Specified in List.addAll
-
addAll
Add elements to a specified index of the wrapped list. Added for convenience.- Parameters:
index- Specified in List.addelements- Specified in List.add- Returns:
- Specified in List.addAll
-
addAll
Add elements to a specified index of the wrapped list. Added for convenience.- Parameters:
index- Specified in List.addgenerateElements- The logic that will generate the elements.- Returns:
- Specified in List.addAll
-