Make JSON a little bit more generic

This commit is contained in:
jeffcheasey88 2023-12-03 10:17:21 +01:00
parent f713e3941d
commit 8ea733c637
2 changed files with 6 additions and 2 deletions

View file

@ -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){

View file

@ -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);
} }