package org.exmaple;
import java.util.HashMap;
import java.util.Map;
public class ExampleOne {
public static void main(String[] args) { Map<String, Object> clause = null; // 1. clause = new HashMap<String, Object>(); clause.put("key1", "value1"); clause = new HashMap<String, Object>(); clause.put("key2", "value2"); clause = new HashMap<String, Object>(); clause.put("key3", "value3"); // 2. clause = new HashMap<String, Object>(); clause.put("key1", "value1"); clause.clear(); clause.put("key2", "value2"); clause.clear(); clause.put("key3", "value3"); }
}
上面是两种不同的写法,那种写法更好?
慕无忌1623718
慕容708150
相关分类