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)
|
public Writer write(Writer writer, int indentFactor, int indent)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
try {
|
try {
|
||||||
boolean hasComma = false;
|
boolean needsComma = false;
|
||||||
int length = this.length();
|
int length = this.length();
|
||||||
writer.write('[');
|
writer.write('[');
|
||||||
|
|
||||||
|
@ -1424,7 +1424,7 @@ public class JSONArray implements Iterable<Object> {
|
||||||
final int newIndent = indent + indentFactor;
|
final int newIndent = indent + indentFactor;
|
||||||
|
|
||||||
for (int i = 0; i < length; i += 1) {
|
for (int i = 0; i < length; i += 1) {
|
||||||
if (hasComma) {
|
if (needsComma) {
|
||||||
writer.write(',');
|
writer.write(',');
|
||||||
}
|
}
|
||||||
if (indentFactor > 0) {
|
if (indentFactor > 0) {
|
||||||
|
@ -1437,7 +1437,7 @@ public class JSONArray implements Iterable<Object> {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new JSONException("Unable to write JSONArray value at index: " + i, e);
|
throw new JSONException("Unable to write JSONArray value at index: " + i, e);
|
||||||
}
|
}
|
||||||
hasComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
if (indentFactor > 0) {
|
if (indentFactor > 0) {
|
||||||
writer.write('\n');
|
writer.write('\n');
|
||||||
|
|
|
@ -2496,7 +2496,7 @@ public class JSONObject {
|
||||||
public Writer write(Writer writer, int indentFactor, int indent)
|
public Writer write(Writer writer, int indentFactor, int indent)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
try {
|
try {
|
||||||
boolean hasComma = false;
|
boolean needsComma = false;
|
||||||
final int length = this.length();
|
final int length = this.length();
|
||||||
writer.write('{');
|
writer.write('{');
|
||||||
|
|
||||||
|
@ -2516,7 +2516,7 @@ public class JSONObject {
|
||||||
} else if (length != 0) {
|
} else if (length != 0) {
|
||||||
final int newIndent = indent + indentFactor;
|
final int newIndent = indent + indentFactor;
|
||||||
for (final Entry<String,?> entry : this.entrySet()) {
|
for (final Entry<String,?> entry : this.entrySet()) {
|
||||||
if (hasComma) {
|
if (needsComma) {
|
||||||
writer.write(',');
|
writer.write(',');
|
||||||
}
|
}
|
||||||
if (indentFactor > 0) {
|
if (indentFactor > 0) {
|
||||||
|
@ -2534,7 +2534,7 @@ public class JSONObject {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
|
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
|
||||||
}
|
}
|
||||||
hasComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
if (indentFactor > 0) {
|
if (indentFactor > 0) {
|
||||||
writer.write('\n');
|
writer.write('\n');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue