1
嘗試使用字符串鍵和HashSets的值生成Hash Map。我想哈希集是所有整數製作一個HashMap,其鍵值爲HashSets
Set<String> numbersSet = new HashSet<Integer>();
// won't work:
HashMap<String, numberSet> database = new HashMap<String, numberSet>();//error - "(or [ expected"
//Also won't work. If it did, how can even I add to the set inside this hashMap?
HashMap<String, HashSet<Integer>> database = new HashMap<String, HashSet<Integer>>(); //error-incompatible types
'地圖<字符串,集> mapOfSets =新的HashMap <字符串,集>();設置 numbersSet = new HashSet (); mapOfSets.put(「numbersSet」,numbersSet);',適用於我。 –
Luiggi,你應該做出答案。 – fish