summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
index 8522058..e69495a 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
@@ -73,6 +73,17 @@ public interface IMap<KeyType, ValueType> {
*/
ValueType get(KeyType key);
+ /**
+ * Get a value from the map, and return a default value if the key
+ * doesn't exist
+ *
+ * @param key
+ * The key to attempt to retrieve
+ * @param defaultValue
+ * The value to return if the key doesn't exist
+ * @return The value associated with the key, or the default value if
+ * the key doesn't exist
+ */
default ValueType getOrDefault(KeyType key, ValueType defaultValue) {
try {
return get(key);