From e62d763294cc5a7c28425a48ac72e9aad83e65d4 Mon Sep 17 00:00:00 2001 From: harkue Date: Wed, 13 Nov 2019 11:46:21 +0800 Subject: [PATCH] rename `hasComma` as a better name "needsComma" --- JSONArray.java | 6 +++--- JSONObject.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/JSONArray.java b/JSONArray.java index 10e08d2..8847c5d 100644 --- a/JSONArray.java +++ b/JSONArray.java @@ -1409,7 +1409,7 @@ public class JSONArray implements Iterable { public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { - boolean hasComma = false; + boolean needsComma = false; int length = this.length(); writer.write('['); @@ -1424,7 +1424,7 @@ public class JSONArray implements Iterable { final int newIndent = indent + indentFactor; for (int i = 0; i < length; i += 1) { - if (hasComma) { + if (needsComma) { writer.write(','); } if (indentFactor > 0) { @@ -1437,7 +1437,7 @@ public class JSONArray implements Iterable { } catch (Exception e) { throw new JSONException("Unable to write JSONArray value at index: " + i, e); } - hasComma = true; + needsComma = true; } if (indentFactor > 0) { writer.write('\n'); diff --git a/JSONObject.java b/JSONObject.java index 90de2e4..399dfe4 100644 --- a/JSONObject.java +++ b/JSONObject.java @@ -2496,7 +2496,7 @@ public class JSONObject { public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { - boolean hasComma = false; + boolean needsComma = false; final int length = this.length(); writer.write('{'); @@ -2516,7 +2516,7 @@ public class JSONObject { } else if (length != 0) { final int newIndent = indent + indentFactor; for (final Entry entry : this.entrySet()) { - if (hasComma) { + if (needsComma) { writer.write(','); } if (indentFactor > 0) { @@ -2534,7 +2534,7 @@ public class JSONObject { } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } - hasComma = true; + needsComma = true; } if (indentFactor > 0) { writer.write('\n');