public static final class ListUtils.Replacement<T>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
ListUtils.Replacement<T> |
all()
Makes all instances of the target value be replaced.
|
ListUtils.Replacement<T> |
first()
Makes only the first instance of the target value be replaced.
|
ListUtils.Replacement<T> |
replace(java.util.function.Predicate<? super T> test)
Sets a predicate to use to test elements in the list.
|
ListUtils.Replacement<T> |
replace(T value)
Sets the element to be replaced.
|
void |
with(java.util.function.Supplier<? extends T> replacementSupplier)
Replaces the elements in the list with values given by the supplier.
|
void |
with(T replacement)
Replaces the elements in the list with the replacement one.
|
public ListUtils.Replacement<T> replace(java.util.function.Predicate<? super T> test)
test
- the test for elements to replacepublic ListUtils.Replacement<T> replace(T value)
value
- the element to be replacedpublic ListUtils.Replacement<T> first()
all()
public ListUtils.Replacement<T> all()
first()
public void with(T replacement)
replacement
- the element to replace the existing onepublic void with(java.util.function.Supplier<? extends T> replacementSupplier)
replacementSupplier
- the supplier to use to get replacement valuesjava.lang.IllegalStateException
- if no values were specified to be replaced with #replace(T)
or replace(Predicate)