本文介绍了错误:找不到合适的方法put(String,int)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编译时出错:
TreeMap <String, Long> myMap = new TreeMap <String, Long>();
//populate the map
myMap.put("preload_buffer_size", 1024);
myMap.put("net_buffer_length", 1024);
//etc...
error: no suitable method found for put(String,int)
myMap.put("preload_buffer_size", 1024);
^
method TreeMap.put(String,Long) is not applicable
(actual argument int cannot be converted to Long by method invocation conversion)
method AbstractMap.put(String,Long) is not applicable
(actual argument int cannot be converted to Long by method invocation conversion)
我需要使用Long,而不是int
我真的不知道如何解决它,如果可以帮助我,我将不胜感激。
And I need to use Long, not intI don't really know how to resolve it, I would appreciate if you could help me with this.
推荐答案
myMap.put("preload_buffer_size", 1024L);
这篇关于错误:找不到合适的方法put(String,int)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!