How to use foreach with lambda for Map<integer,map<string,string>&gt;

时间:2017-01-03 20:32:40

标签: java lambda foreach

How can i use forEach with lamba for something like:

Map<Integer,Map<String,String>

i want to check if Map (this - string,string) contains key in function parameter

thanks for help ;)

1 个答案:

答案 0 :(得分:2)

static boolean containsInnerKey(String key, Map<Integer, Map<String, String>> map) {
    return map.values()
            .stream()
            .anyMatch(m -> m.containsKey(key));
}