mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
rename hasComma
as a better name "needsComma"
This commit is contained in:
parent
4990c3a180
commit
e62d763294
2 changed files with 6 additions and 6 deletions
|
@ -1409,7 +1409,7 @@ public class JSONArray implements Iterable<Object> {
|
|||
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<Object> {
|
|||
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<Object> {
|
|||
} 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');
|
||||
|
|
|
@ -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<String,?> 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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue