我有一段代码用于生成图表:
HashMap<String, List<Ticket>> openedTicketsPerTeam = getOpenedTicketsPerTeam();
我应该如何编写通用方法的签名来计算列表的长度,每个 Map 元素?我的想法是:
Map<String, Integer> getNumOfValuesPerKey(HashMap<String, List<? extends Object>> map) {...}
但调用后出现转换错误:
HashMap<String, Integer> numOfTicketsPerTeam = getNumOfValuesPerKey(openedTicketsPerTeam );