我有一个 Hashmap <String,Integer
> 类型的变量。
在这种情况下,整数值可能必须根据标志变量的值进行一些操作。我是这样做的...
Hashmapvariable.put( somestring,
if (flag_variable) {
//manipulation code goes here
new Integer(manipulated value);
} else {
new Integer(non-manipulated value);
}
);
但我收到一个错误:
令牌上的语法错误,错误的构造。
在 Hashmapvariable.put 调用中。
我还收到另一个错误
标记 ")" 上的语法错误,删除此标记。
在最后的“);” 线。但我不能删除“)”——它是 put 方法调用的右括号。
我不明白这个。我在做什么错?