使用HashMap儲存資料: 放入資料
hashMap.put(key, value);讀取資料
hashMap.get(key)拿出資料
hashMap.remove(key); // returns value迴圈拿資料:
for(HashMap.Entry<Integer, Integer> data : hashMap.entrySet()){
//注意,Entry是Map的方法
data.getValue();
data.getKey();
}使用HashMap儲存資料: 放入資料
hashMap.put(key, value);讀取資料
hashMap.get(key)拿出資料
hashMap.remove(key); // returns value迴圈拿資料:
for(HashMap.Entry<Integer, Integer> data : hashMap.entrySet()){
//注意,Entry是Map的方法
data.getValue();
data.getKey();
}