long (Map<String, List<String>> strings) { return strings.entrySet().stream().filter(e -> !e.getKey().isEmpty()) .flatMap(entry -> entry.getValue().stream().filter(entry.getKey()::equals)) .count(); }