add union(IntList,IntList) and addAll(IntList)
IntPredicate gets the current value and the index. This was handy while removing duplicate values.
This commit is contained in:
@@ -11,11 +11,13 @@ public interface IntPredicate {
|
||||
/**
|
||||
* Evaluates the predicate.
|
||||
*
|
||||
* @param i
|
||||
* the input argument
|
||||
* @param value
|
||||
* the value
|
||||
* @param index
|
||||
* the index in the list
|
||||
* @return {@code true} iff the input argument matches the predicate
|
||||
*/
|
||||
boolean test(int i);
|
||||
boolean test(int value, int index);
|
||||
|
||||
/**
|
||||
* Returns a predicate that represents the logical AND of {@code this} and
|
||||
@@ -28,7 +30,7 @@ public interface IntPredicate {
|
||||
* if {@code other} is null
|
||||
*/
|
||||
default IntPredicate and(final IntPredicate other) {
|
||||
return (t) -> test(t) && other.test(t);
|
||||
return (value, index) -> test(value, index) && other.test(value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,7 @@ public interface IntPredicate {
|
||||
* if {@code other} is null
|
||||
*/
|
||||
default IntPredicate or(final IntPredicate other) {
|
||||
return (t) -> test(t) || other.test(t);
|
||||
return (value, index) -> test(value, index) || other.test(value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,6 @@ public interface IntPredicate {
|
||||
* @return the negation of {@code this}
|
||||
*/
|
||||
default IntPredicate negate() {
|
||||
return (t) -> !test(t);
|
||||
return (value, index) -> !test(value, index);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user