Is it possible to use a primitive type (int) in as

2019-01-09 14:56发布

Specifically, with a SortedMap<Vector<String>, int> I get "dimensions expected after this (int) token." Help!

2条回答
淡お忘
2楼-- · 2019-01-09 15:14

Konrad is correct. Alternately, you can use the trove class TObjectIntHashMap to map Objects to primitive ints.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-09 15:15

No, this is not possible. Use Integer instead. Autoboxing takes care of the rest (i.e. for most purposes you can program as if you had actually used int because Java converts to and from Integer automatically for you).

查看更多
登录 后发表回答