I have one Map<String, Boolean> map = new HashMap<>();.
Consider there are five keys in it.
map.put("A", true); map.put("B", true); map.put("C", false); map.put("D", true); map.put("E", true); I need to set one boolean flag as true if all the values in the above map are true.
If any value is false then i need to set boolean flag as false
I can iterate this map and do it like old ways but i want to know how can i do this in a single line by streaming on this map.
https://stackoverflow.com/questions/67293960/check-if-all-values-of-a-map-are-true April 28, 2021 at 12:54PM
没有评论:
发表评论