add join() method to Int/Float/StringList

This commit is contained in:
Ben Fry
2013-08-12 08:57:28 -04:00
parent 5f7a63aad3
commit 61b34b4f9b
4 changed files with 45 additions and 0 deletions
+14
View File
@@ -749,6 +749,20 @@ public class FloatList implements Iterable<Float> {
}
public String join(String separator) {
if (count == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(data[0]);
for (int i = 1; i < count; i++) {
sb.append(separator);
sb.append(data[i]);
}
return sb.toString();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+14
View File
@@ -757,6 +757,20 @@ public class IntList implements Iterable<Integer> {
}
public String join(String separator) {
if (count == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(data[0]);
for (int i = 1; i < count; i++) {
sb.append(separator);
sb.append(data[i]);
}
return sb.toString();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+14
View File
@@ -688,6 +688,20 @@ public class StringList implements Iterable<String> {
// }
public String join(String separator) {
if (count == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(data[0]);
for (int i = 1; i < count; i++) {
sb.append(separator);
sb.append(data[i]);
}
return sb.toString();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
+3
View File
@@ -28,6 +28,7 @@ X perhaps it's a getGraphics() issue?
X when using increment() on IntList, make sure the index exists
X automatically resize the list if necessary
X (this is more in keeping with increment() in the Dict classes)
X add join() method to Int/Float/StringList
cleaning
X load/save methods.. is it save("blah.svg") or saveSVG("blah.svg")
@@ -41,6 +42,8 @@ _ https://github.com/processing/processing/issues/2012
_ add option to have full screen span across screens
_ display=all in cmd line
_ sketchDisplay() -> 0 for all, or 1, 2, 3...
_ add optional/default values for get methods in JSON
_ add isNull() method back to JSONObject/Array
_ test PGraphicsRetina2D w/ 7u40
_ make sure that 7u40 doesn't reintroduce starvation issue on retina Macs