getValue method

V getValue(
  1. K key
)

Returns the value for the given key or throws an exception if there is no such key in the map.

@throws NoSuchElementException when the map doesn't contain a value for the specified key

Implementation

V getValue(K key) {
  final value = get(key);
  if (value == null) {
    throw NoSuchElementException("Key $key is missing in the map.");
  }
  return value;
}