If the values ββare expected to be integers, I would change the type of Map to Map<String,Integer> :
List<Map<String,Integer>> list;
Then you can find the maximum with:
int max = list.stream() .map(map->map.get("A")) .filter(Objects::nonNull) .mapToInt(Integer::intValue) .max() .orElse(someDefaultValue);
You can make it shorter using getOrDefault instead of get to avoid null values:
int max = list.stream() .mapToInt(map->map.getOrDefault("A",Integer.MIN_VALUE)) .max(); .orElse(someDefaultValue);
source share