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

Prefer unsynchronized StringBuilder

StringBuffer provides unneeded synchronization.  Found via
error-prone.
This commit is contained in:
Andrew Gaul 2019-07-22 22:26:49 -07:00
parent a03a01531a
commit 4d451468fd

View file

@ -55,7 +55,7 @@ public class CDL {
private static String getValue(JSONTokener x) throws JSONException { private static String getValue(JSONTokener x) throws JSONException {
char c; char c;
char q; char q;
StringBuffer sb; StringBuilder sb;
do { do {
c = x.next(); c = x.next();
} while (c == ' ' || c == '\t'); } while (c == ' ' || c == '\t');
@ -65,7 +65,7 @@ public class CDL {
case '"': case '"':
case '\'': case '\'':
q = c; q = c;
sb = new StringBuffer(); sb = new StringBuilder();
for (;;) { for (;;) {
c = x.next(); c = x.next();
if (c == q) { if (c == q) {
@ -275,7 +275,7 @@ public class CDL {
if (names == null || names.length() == 0) { if (names == null || names.length() == 0) {
return null; return null;
} }
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < ja.length(); i += 1) { for (int i = 0; i < ja.length(); i += 1) {
JSONObject jo = ja.optJSONObject(i); JSONObject jo = ja.optJSONObject(i);
if (jo != null) { if (jo != null) {