我有一个对象列表:
static List table_rows = new ArrayList();
我想用 TreeMaps 填充它,它由一个字符串和一个整数数组对象组成:
for (int i = 0; i < observation_files.length; i++) {
TreeMap<String, Integer[]> tm = new TreeMap<String, Integer[]>();
Integer[] cells = new Integer[observation_files.length];
for (int x = 0; x < cells.length; x++) {
cells[x] = 0;
}
tm.put("model" + i, cells);
table_rows.add(tm);
}
现在我想像这样访问 int 数组:
table_rows.get(0).get("model1")[0] = 2;
但是eclipse不允许我这样做并给我这个错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method get(String) is undefined for the type Object
Syntax error on token ".", Identifier expected after this token
at HmmPipeline.main(HmmPipeline.java:102)
代码提示或补全让我无法使用,我做错了什么?