Iteration in List of List items & check items with ruleValue..!
Intuition\nSimple Iteration only..!\n\n# Approach\nDetermine Index: The code first determines which index to check in each item based on the ruleKey. The index 
# Intuition\nSimple Iteration only..!\n\n# Approach\n**Determine Index:** The code first determines which index to check in each item based on the ruleKey. The index corresponds to the position in the sub-list (0 for "type", 1 for "color", and 2 for "name").\n\n**Iterate and Count:** The code then iterates over the list of items and checks if the value at the determined index matches the ruleValue. If it does, it increments the count.\n\n**Return Result:** Finally, the code returns the count of items that match the rule.\n\n# Complexity\n- **Time complexity:** So, overall time complexity is O(n).\n\n- Space complexity: O(1) in constant.\n\n# Code\n```java []\npublic class Solution {\n    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n        int count = 0;\n        int index = 0;\n        if (ruleKey.equals("type")) {\n            index = 0;\n        } else if (ruleKey.equals("color")) {\n            index = 1;\n        } else if (ruleKey.equals("name")) {\n            index = 2;\n        }\n        for (List<String> item : items) {\n            if (item.get(index).equals(ruleValue)) {\n                count++;\n            }\n        }\n        return count;\n    }\n}\n```
['Iterator', 'Java']