问题
Model
private HashMap<String, Object> data;
public Mode() {
this.data = new HashMap<String, Object>();
}
public Object get(Mode value) {
return this.data.get(value);
}
public void set(String key, Object value) {
this.data.put(key, value);
}
}
How do I set and get the value using this model?
回答1:
Try this
public Object get(String key) {
return this.data.get(key);
}
public void set(String key, Object value) {
this.data.put(key, value);
}
来源:https://stackoverflow.com/questions/43753983/how-to-set-and-get-using-model-in-hashmap