我想傳遞一個包含密鑰的地圖和值是列表視圖, 這2個方法是在得到從2方法參數從java中的方法中獲取參數值的最佳做法?
Map<String, List<String>> mMap;
public static void add(Map<String, List<String> map) {
mMap = map; // direct get and assign to map object
}
public static void add(Map<String, List<String> map) {
try {
//Copies all of the mappings from the specified map to this map
mMap.putAll(map);
} catch (Exception e) {
}
}
地圖一個很好的做法是正確的方式將map參數的值賦給我們新的Map對象?
一號方法取代舊的值,如果你想這樣.. – Batty
謝謝你guyz所有的信息你給我! –