Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用以下代码
for(Map.Entry<Integer, Long> entry : resultMap.entrySet()){ }
但我收到一个错误:无法转换Object为Map.Entry<Integer, Long> 我忘了在某处添加演员表吗?
Object
Map.Entry<Integer, Long>
编辑是的,我将其声明为原始类型。现在更正了,谢谢。
我怀疑您的resultMap变量是原始类型。你需要:
resultMap
Map<Integer, Long> resultMap = ...;
而我怀疑你有:
Map resultMap = ...;