Skip to content

Commit 43060f8

Browse files
committed
Added utility method for position and value in the stream filters
1 parent e33a521 commit 43060f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/java/org/tensorics/core/tensor/stream/TensorStreamFilters.java

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package org.tensorics.core.tensor.stream;
2424

2525
import java.util.Map;
26+
import java.util.function.BiPredicate;
2627
import java.util.function.Predicate;
2728

2829
import org.tensorics.core.tensor.Position;
@@ -51,4 +52,8 @@ public static <T> Predicate<Map.Entry<Position, T>> byPosition(Predicate<Positio
5152
public static <T> Predicate<Map.Entry<Position, T>> byValue(Predicate<T> valuePredicate) {
5253
return entry -> valuePredicate.test(entry.getValue());
5354
}
55+
56+
public static <T> Predicate<Map.Entry<Position, T>> byPositionValue(BiPredicate<Position, T> valuePredicate) {
57+
return entry -> valuePredicate.test(entry.getKey(), entry.getValue());
58+
}
5459
}

0 commit comments

Comments
 (0)