MapContainsPredicate
See javadoc - uk.gov.gchq.koryphe.impl.predicate.MapContainsPredicate
Available since Koryphe version 1.0.0
Checks if a map contains a key that matches a predicate
Examples
Map contains predicate
Java
JSON
Full JSON
Python
final MapContainsPredicate function = new MapContainsPredicate(new Regex("a.*"));
{
"class" : "MapContainsPredicate",
"keyPredicate" : {
"class" : "Regex",
"value" : {
"java.util.regex.Pattern" : "a.*"
}
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.MapContainsPredicate",
"keyPredicate" : {
"class" : "uk.gov.gchq.koryphe.impl.predicate.Regex",
"value" : {
"java.util.regex.Pattern" : "a.*"
}
}
}
g.MapContainsPredicate(
key_predicate=g.Regex(
value={'java.util.regex.Pattern': 'a.*'}
)
)
Input type:
java.util.Map
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashMap | {a1=1, a2=2, b=2, c=3} | true |
java.util.HashMap | {b=2, c=3} | false |
java.util.HashMap | {a=null, b=2, c=3} | true |