gpt4 book ai didi

java - 错误 : no suitable method found for put(String, int)

转载 作者:行者123 更新时间:2023-12-01 23:10:39 25 4
gpt4 key购买 nike

编译时出现错误:

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);

关于java - 错误 : no suitable method found for put(String, int),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22079429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com