Consider you have a map myMap.
map myMap
Given the expression \"some.string.*\", I have to retrieve all the values from m
\"some.string.*\"
m
Remove all keys which does not start with your desired prefix:
yourMap.keySet().removeIf(key -> !key.startsWith(keyPrefix));