getOption method

Option<V> getOption(
  1. K key
)

Safely gets the value for a given key, returning an Option.

Implementation

Option<V> getOption(K key) {
  // V does not need to extend Object here because this[key] can be null.
  // Option.from() correctly handles creating a Some<V> or a None<V>.
  return Option.from(this[key]);
}