Simple Java Solution with explanation
Kindly upvote if it helps you!\n```\npublic int countMatches(List> items, String ruleKey, String ruleValue) {\n        int index = -1, count =0;\n\t\t//Using sw
Kindly upvote if it helps you!\n```\npublic int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n        int index = -1, count =0;\n\t\t//Using switch case identify against which index in the List, ruleValue has to be matched \n        switch(ruleKey){\n            case "type" : index = 0;\n            break;\n            case "color" : index = 1;\n            break;\n            default : index = 2;\n        }\n        for (List<String> item : items) {\n\t\t//Comparing the value at index i with ruleValue & incrementing count\n            if (item.get(index).equals(ruleValue))\n            count += 1;\n            }\n        return count;\n    }
['Java']