這是我的HashMap:哈希映射在哈希表嘗試插入一些
protected HashMap<String, HashMap<String, Player>> prisonsPlayers = new HashMap<String, HashMap<String, Player>>();
我嘗試插入它的東西:
prisonsPlayers.put(player.getWorld(), (HashMap<player.getName(), player>));
Erorr我得到:
Multiple markers at this line
- Syntax error, insert ")" to complete
Expression
- Syntax error on token ")", invalid
Expression
我知道我做錯了什麼,但是我嘗試了,我做了什麼,我不知道如何將該數據插入到我的散列表中。有人能幫助我嗎?
不,泛型是編譯時間,而不是運行時間。您不能將方法返回的值用作類型參數。也請查看Java語法。實際上,取消關於泛型的所有知識,並從Java泛型教程開始。 –