Skip to content

Commit dd1bafa

Browse files
committed
add hasKey() methods
1 parent 9986be5 commit dd1bafa

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

core/src/processing/data/FloatDict.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ public void set(String key, int amount) {
246246
}
247247

248248

249+
public boolean hasKey(String key) {
250+
return index(key) != -1;
251+
}
252+
253+
249254
// /** Increase the value of a specific key by 1. */
250255
// public void inc(String key) {
251256
// inc(key, 1);

core/src/processing/data/IntDict.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ public void set(String key, int amount) {
235235
}
236236

237237

238+
public boolean hasKey(String key) {
239+
return index(key) != -1;
240+
}
241+
242+
238243
/** Increase the value of a specific key by 1. */
239244
public void increment(String key) {
240245
add(key, 1);

core/src/processing/data/StringDict.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ public int index(String what) {
215215
}
216216

217217

218+
public boolean hasKey(String key) {
219+
return index(key) != -1;
220+
}
221+
222+
218223
protected void create(String key, String value) {
219224
if (count == keys.length) {
220225
keys = PApplet.expand(keys);

0 commit comments

Comments
 (0)