Merge remote-tracking branch 'gui/main' into merge-gui-and-server

This commit is contained in:
lucas lelievre committed 2022-11-13 02:27:28 +01:00
commit ae94de39b1
430 files changed
+44297 -50

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
package org.json;
import java.util.Map.Entry;
public class JSONUtil {
public static JSONObject toJSON(JSONEntry... entries) {
return o(entries);
}
public static JSONObject o(JSONEntry... entries) {
JSONObject object = new JSONObject();
for (int i = 0; i < entries.length; ++i) {
JSONEntry e = entries[i];
object.put(e.getKey(), e.getValue());
}
return object;
}
public static JSONArray a(Object... values) {
return new JSONArray(values);
}
public static JSONEntry e(String k, Object v) {
return new JSONEntry(k, v);
}
public static class JSONEntry implements Entry<String, Object> {
private String key;
private Object value;
public JSONEntry(String key, Object value) {
this.key = key;
this.value = value;
}
@Override
public String getKey() {
return this.key;
}
@Override
public Object getValue() {
return this.value;
}
@Override
public Object setValue(Object value) {
Object oldValue = this.value;
this.value = value;
return oldValue;
}
}
}