getOrDefault

fun getOrDefault(key: DataItem, defaultValue: DataItem): DataItem
fun getOrDefault(key: String, defaultValue: DataItem): DataItem
fun getOrDefault(key: Long, defaultValue: DataItem): DataItem

Gets the value of a key in a map or a default value if the key doesn't exist.

Return

the DataItem for the given key or the default value.

Parameters

key

the key to get the value for.

defaultValue

the value to return if the key doesn't exist in the map.

Throws

if the data item isn't a CborMap.