import java.util.HashMap;
/**
* <p>
* Copyright©2013-2015 AutoChina International Ltd. All rights reserved.
* </p>
* 作为一个基类就可以了
* @Author {Your_Name}
*/
public class MapAddMethord<K, V> extends HashMap<K, V> {
public MapAddMethord<K, V> add(K k, V v) {
this.put(k, v);
return this;
}
public static void main(String[] args) {
MapAddMethord<String, String> kvMap = new MapAddMethord<String, String>();
kvMap.add("a", "b").add("c", "d");
for (String key : kvMap.keySet()) {
System.out.println(key + "-" + kvMap.get(key));
}
}
}