我正在尝试将一组对象及其等效 id 放在 HashMap 中。
这是我的 HashMap:
private Map<String, Value[]> array_memory = new HashMap<String, Value[]>();
Run Code Online (Sandbox Code Playgroud)
这是我的对象数组:
Value[] array = new Value[x];
Run Code Online (Sandbox Code Playgroud)
这就是我将它们放入 array_memory 的方式:
return array_memory.put(id, array);
Run Code Online (Sandbox Code Playgroud)
但是,当我运行我的程序时,我收到此错误:
error: incompatible types: Value[] cannot be converted to Value
return array_memory.put(id, array);
^
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。(如果我遗漏了一些明显的东西,我想道歉,我已经为此工作了几个小时,但我的状态并不是最好的)。
感谢您的时间!
| 归档时间: |
|
| 查看次数: |
55 次 |
| 最近记录: |