mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
fix how missing values are handled in dictionaries
This commit is contained in:
@@ -298,10 +298,20 @@ public class IntDict {
|
||||
*/
|
||||
public int get(String key) {
|
||||
int index = index(key);
|
||||
if (index == -1) return 0;
|
||||
if (index == -1) {
|
||||
throw new IllegalArgumentException("No key named '" + key + "'");
|
||||
}
|
||||
return values[index];
|
||||
}
|
||||
|
||||
|
||||
public int get(String key, int alternate) {
|
||||
int index = index(key);
|
||||
if (index == -1) return alternate;
|
||||
return values[index];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new key/value pair or change the value of one.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user