If I have a List<Map<String, String>> object such as this tempNameMapList:
0
0 = "id" -> 101
1 = "name" -> jonathan
1
0 = "id" -> 102
1 = "name" -> sam
2
0 = "id" -> 103
1 = "name" -> tim
And a String object such as String name = "tim", how would I quickly check that it exists in tempNameMapList?
One possible solution using Java 8 anyMatch(...):
boolean exists = tempNameMapList.stream().anyMatch(map -> map.containsValue("tim"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With