mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
add appendUnique() to Int/Float/StringList
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user