编译时出现错误:
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
我真的不知道如何解决它,如果您能帮助我,我将不胜感激。
最佳答案
myMap.put("preload_buffer_size", 1024L);