67,513
社区成员
发帖
与我相关
我的任务
分享
/**
* 可以连续put的map工具
* @param <String>
* @param <T>
*/
public class MapPPP<String, T> implements Cloneable, java.io.Serializable{
private static final long serialVersionUID = 8683432581122892119L;
private Map<String, T> _map;
public MapPPP() {
_map = Maps.newHashMap();
}
public MapPPP<String, T> put(String key, T value) {
_map.put(key, value);
return this;
}
public int size() {
return _map.size();
}
public Set<Map.Entry<String, T>> entrySet() {
return _map.entrySet();
}
}
public class TestMain {
public static void main(String[] args) {
MapPPP<String, String> replaceDataMap = new MapPPP<>();
replaceDataMap.put("a", "v1").put("dddd", "").put("c","");
System.out.println(JSONObject.toJSONString(replaceDataMap));
}
}