[java] easy and efficient solution !
\nclass Solution {\n    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n \n        \n        int count=0;\n      \n      
```\nclass Solution {\n    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n \n        \n        int count=0;\n      \n        switch(ruleKey){\n                \n            case "type"  :   for(int i=0; i<items.size(); i++ ){\n                                if(items.get(i).get(0).equals(ruleValue))\n                                count++;\n            }\n                              return count;                \n                \n            case "color" :for(int i=0; i<items.size(); i++ ){\n                                if(items.get(i).get(1).equals(ruleValue) )\n                                count++;\n            }\n                              return count;\n                \n            case "name"  :    for(int i=0; i<items.size(); i++ ){\n                                if(items.get(i).get(2).equals(ruleValue))\n                                count++;\n            } \n                              return count;\n        }\n        \n        return count;\n        \n    \n    }\n}\n```
[]