add hasKey() methods

This commit is contained in:
Ben Fry
2013-04-28 15:13:51 -04:00
parent 2daa6269b2
commit 3ab855e69a
3 changed files with 15 additions and 0 deletions

View File

@@ -246,6 +246,11 @@ public class FloatDict {
}
public boolean hasKey(String key) {
return index(key) != -1;
}
// /** Increase the value of a specific key by 1. */
// public void inc(String key) {
// inc(key, 1);

View File

@@ -235,6 +235,11 @@ public class IntDict {
}
public boolean hasKey(String key) {
return index(key) != -1;
}
/** Increase the value of a specific key by 1. */
public void increment(String key) {
add(key, 1);

View File

@@ -215,6 +215,11 @@ public class StringDict {
}
public boolean hasKey(String key) {
return index(key) != -1;
}
protected void create(String key, String value) {
if (count == keys.length) {
keys = PApplet.expand(keys);