[New] Added ListParameter.removeValueIf()
This commit is contained in:
parent
7fd30fbca4
commit
57821adb88
|
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
|
@ -173,6 +174,12 @@ public abstract class AbstractListParameter<E> extends AbstractParameter<List<E>
|
|||
return this.value.remove(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeValueIf(Predicate<E> predicate) {
|
||||
assertNotReadonly();
|
||||
return this.value.removeIf(predicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
assertNotReadonly();
|
||||
|
|
|
@ -17,6 +17,7 @@ package li.strolch.model.parameter;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
|
@ -96,6 +97,16 @@ public interface ListParameter<E> extends Parameter<List<E>> {
|
|||
*/
|
||||
boolean removeValue(E value);
|
||||
|
||||
/**
|
||||
* Removes all values from the {@link List} of values if the predicate passes
|
||||
*
|
||||
* @param predicate
|
||||
* the predicate to evaluate if the value should be removed
|
||||
*
|
||||
* @return true if any values were removed
|
||||
*/
|
||||
boolean removeValueIf(Predicate<E> predicate);
|
||||
|
||||
/**
|
||||
* Clears the list of values, i.e the list of values is empty after this call
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue