Java
\npublic int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n       \n        int n = items.size();\n        int k = 0;\n        int
```\npublic int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n       \n        int n = items.size();\n        int k = 0;\n        int ans=0;\n        if (ruleKey.equals("color")) k=1;\n        else if (ruleKey.equals("name")) k=2;\n        for (List cur : items){\n            if (cur.get(k).equals(ruleValue))\n                ans++;\n        }\n        return ans;\n    }\n```
[]