27. Map에서 조건에 맞는 요소 찾기
// 값이 2 이상인 첫 번째 요소 찾기 Optional firstMatch = map.entrySet().stream() .filter(entry -> entry.getValue() >= 2) .findFirst(); // 값이 2 이상인 모든 요소 찾기 List allMatches = map.entrySet().stream() .filter(entry -> entry.getValue() >= 2) .collect(Collectors.toList());