Skip to content

Commit 77ca461

Browse files
authored
allow config init size of jsonarray and jsonobject (#81)
1 parent 509dfaa commit 77ca461

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

json-smart/src/main/java/net/minidev/json/JSONArray.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
public class JSONArray extends ArrayList<Object> implements List<Object>, JSONAwareEx, JSONStreamAwareEx {
3131
private static final long serialVersionUID = 9106884089231309568L;
3232

33+
public JSONArray() {
34+
}
35+
36+
public JSONArray(int initialCapacity) {
37+
super(initialCapacity);
38+
}
39+
3340
public static String toJSONString(List<? extends Object> list) {
3441
return toJSONString(list, JSONValue.COMPRESSION);
3542
}

json-smart/src/main/java/net/minidev/json/JSONObject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public JSONObject() {
3535
super();
3636
}
3737

38+
public JSONObject(int initialCapacity) {
39+
super(initialCapacity);
40+
}
41+
3842
/**
3943
* Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
4044
* (U+0000 through U+001F). It's the same as JSONValue.escape() only for

0 commit comments

Comments
 (0)