ifEmpty<R extends KtMap<K, V>> method

R ifEmpty<R extends KtMap<K, V>>(
  1. R defaultValue()
)

Returns this map if it's not empty or the result of calling defaultValue function if the map is empty.

Implementation

R ifEmpty<R extends KtMap<K, V>>(R Function() defaultValue) {
  if (isEmpty()) return defaultValue();
  return this as R;
}