1773. 统计匹配检索规则的物品数量
class Solution {public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {int count = 0;if (ruleKey.equals("type")) {for (List<String> item : items ) {if (item.get(0).equals(ruleValue))++count;}} else if (ruleKey.equals("color")) {for (List<String> item : items ) {if (item.get(1).equals(ruleValue))++count;}} else { //namefor (List<String> item : items ) {if (item.get(2).equals(ruleValue))++count;}}return count;}}
