1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Replace JSONObject constructor string arrays with var args

This commit is contained in:
scott 2019-10-16 21:12:02 -07:00
parent 044b035847
commit 223e328161

View file

@ -194,7 +194,7 @@ public class JSONObject {
* @param names * @param names
* An array of strings. * An array of strings.
*/ */
public JSONObject(JSONObject jo, String[] names) { public JSONObject(JSONObject jo, String ... names) {
this(names.length); this(names.length);
for (int i = 0; i < names.length; i += 1) { for (int i = 0; i < names.length; i += 1) {
try { try {
@ -378,7 +378,7 @@ public class JSONObject {
* An array of strings, the names of the fields to be obtained * An array of strings, the names of the fields to be obtained
* from the object. * from the object.
*/ */
public JSONObject(Object object, String names[]) { public JSONObject(Object object, String ... names) {
this(names.length); this(names.length);
Class<?> c = object.getClass(); Class<?> c = object.getClass();
for (int i = 0; i < names.length; i += 1) { for (int i = 0; i < names.length; i += 1) {