第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將值放入內(nèi)部 Map

將值放入內(nèi)部 Map

梵蒂岡之花 2022-12-28 14:28:47
我有一個看起來像這樣的 ConcurrentHashMap:private Map<String,Map<String,Set<PublicKey>>> instancePairs = new ConcurrentHashMap<>();以及一個應該填充此哈希圖的方法。但我無法弄清楚如何將值放入地圖中目前我有:instancePairs.putIfAbsent(inMemoryInstance.getUsername(), inMemoryInstance.getId() , publicKeySet);Intellij Idea 給我這個錯誤:
查看完整描述

1 回答

?
鳳凰求蠱

TA貢獻1825條經(jīng)驗 獲得超4個贊

正如“DDovzhenko”所提到的,你需要按照以下幾行做一些事情。


//Get the map containing the ID as keys, if it doesn't exist, then create one.

Map mapValuesForName = instancePairs.getOrDefault(inMemoryInstance.getUsername(), new ConcurrentHashMap<String,Set<PublicKey>>());


//Put the publicKeySet based on the Id.

mapValuesForName.putIfAbsent(inMemoryInstance.getId(), publicKeySet);


//Store the potentially changed/new value back in original map.

instancePairs.put(mapValuesForName);


查看完整回答
反對 回復 2022-12-28
  • 1 回答
  • 0 關注
  • 85 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號