getOrElse¶
Gets the item for the given key from a map< K, V > or nested value from an optional or try value.
If no value is available for the map or optional value, the last parameter value is returned.
Parameters:
No. | Type | Comments |
---|---|---|
1 | map< K, V > or T ? or try< T > | The target map, try or optional value |
2 | Value of type K or int |
Key or index to be used to read the map or list. Not specified if 1st arg is an optional or try value |
3 | Value of type ‘V’ | Value to be returned if no value was present in the container type - 1st argument |
Returns: Optional map value or list element
Usages:
getOrElse( v:map<K, V>, key:K, elz : V ) : V
getOrElse( v: V ?, elz : V) : V
getOrElse( v: try< V >, elz : V) : V