Skip to content

Commit e62d763

Browse files
committed
rename hasComma as a better name "needsComma"
1 parent 4990c3a commit e62d763

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

JSONArray.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ public Writer write(Writer writer) throws JSONException {
14091409
public Writer write(Writer writer, int indentFactor, int indent)
14101410
throws JSONException {
14111411
try {
1412-
boolean hasComma = false;
1412+
boolean needsComma = false;
14131413
int length = this.length();
14141414
writer.write('[');
14151415

@@ -1424,7 +1424,7 @@ public Writer write(Writer writer, int indentFactor, int indent)
14241424
final int newIndent = indent + indentFactor;
14251425

14261426
for (int i = 0; i < length; i += 1) {
1427-
if (hasComma) {
1427+
if (needsComma) {
14281428
writer.write(',');
14291429
}
14301430
if (indentFactor > 0) {
@@ -1437,7 +1437,7 @@ public Writer write(Writer writer, int indentFactor, int indent)
14371437
} catch (Exception e) {
14381438
throw new JSONException("Unable to write JSONArray value at index: " + i, e);
14391439
}
1440-
hasComma = true;
1440+
needsComma = true;
14411441
}
14421442
if (indentFactor > 0) {
14431443
writer.write('\n');

JSONObject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ static final void indent(Writer writer, int indent) throws IOException {
24962496
public Writer write(Writer writer, int indentFactor, int indent)
24972497
throws JSONException {
24982498
try {
2499-
boolean hasComma = false;
2499+
boolean needsComma = false;
25002500
final int length = this.length();
25012501
writer.write('{');
25022502

@@ -2516,7 +2516,7 @@ public Writer write(Writer writer, int indentFactor, int indent)
25162516
} else if (length != 0) {
25172517
final int newIndent = indent + indentFactor;
25182518
for (final Entry<String,?> entry : this.entrySet()) {
2519-
if (hasComma) {
2519+
if (needsComma) {
25202520
writer.write(',');
25212521
}
25222522
if (indentFactor > 0) {
@@ -2534,7 +2534,7 @@ public Writer write(Writer writer, int indentFactor, int indent)
25342534
} catch (Exception e) {
25352535
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
25362536
}
2537-
hasComma = true;
2537+
needsComma = true;
25382538
}
25392539
if (indentFactor > 0) {
25402540
writer.write('\n');

0 commit comments

Comments
 (0)