Make JSON a little bit more generic
This commit is contained in:
parent
f713e3941d
commit
8ea733c637
2 changed files with 6 additions and 2 deletions
|
@ -13,8 +13,8 @@ public class JsonArray extends Json{
|
||||||
this.list = new ArrayList<>();
|
this.list = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Object> toList(){
|
public <E> Collection<E> toList(){
|
||||||
return this.list;
|
return (Collection<E>) this.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Object value){
|
public void add(Object value){
|
||||||
|
|
|
@ -18,6 +18,10 @@ public class JsonMap extends Json{
|
||||||
return this.map.entrySet();
|
return this.map.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<String> keys(){
|
||||||
|
return this.map.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
public void set(String key, Object value){
|
public void set(String key, Object value){
|
||||||
this.map.put(key, value);
|
this.map.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue