fix how missing values are handled in dictionaries

This commit is contained in:
Ben Fry
2014-11-07 09:30:25 -05:00
parent 33b2adbfe2
commit 920a0e0e94
3 changed files with 31 additions and 2 deletions

View File

@@ -246,6 +246,14 @@ public class StringDict {
return values[index];
}
public String get(String key, String alternate) {
int index = index(key);
if (index == -1) return alternate;
return values[index];
}
/**
* @webref stringdict:method
* @brief Create a new key/value pair or change the value of one