getOfOrDefault

inline fun <T : Any> StringKeyedMap<*>.getOfOrDefault(key: String, default: T): T

Utility function for getting a key from the given String-keyed map, attempting to cast it to the given generic type, T. Will return the provided default value if the key is missing or the value cannot be cast.

Note: This function does not support maps with nullable values.


inline fun <T : Any> MutableStringKeyedMap<Any>.getOfOrDefault(key: String, default: T, store: Boolean = false): T

Utility function for getting a key from the given String-keyed map, attempting to cast it to the given generic type, T. Will return the provided default value if they key is missing or the value cannot be cast.

If store is true, this will store the given default value if the key is missing or the value cannot be cast.

Note: This function does not support maps with nullable values.