add appendUnique() to Int/Float/StringList

This commit is contained in:
Ben Fry
2015-05-17 11:46:20 -04:00
parent 79aaadaadd
commit 6e5f8a1dae
5 changed files with 31 additions and 1 deletions
+8
View File
@@ -285,6 +285,14 @@ public class FloatList implements Iterable<Float> {
}
/** Add this value, but only if it's not already in the list. */
public void appendUnique(float value) {
if (!hasValue(value)) {
append(value);
}
}
// public void insert(int index, int value) {
// if (index+1 > count) {
// if (index+1 < data.length) {
+8
View File
@@ -254,6 +254,14 @@ public class IntList implements Iterable<Integer> {
}
/** Add this value, but only if it's not already in the list. */
public void appendUnique(int value) {
if (!hasValue(value)) {
append(value);
}
}
// public void insert(int index, int value) {
// if (index+1 > count) {
// if (index+1 < data.length) {
+8
View File
@@ -314,6 +314,14 @@ public class StringList implements Iterable<String> {
}
/** Add this value, but only if it's not already in the list. */
public void appendUnique(String value) {
if (!hasValue(value)) {
append(value);
}
}
// public void insert(int index, int value) {
// if (index+1 > count) {
// if (index+1 < data.length) {