toMap method

  1. @useResult
KtMap<K, V> toMap()

Returns a new read-only map containing all key-value pairs from the original map.

The returned map preserves the entry iteration order of the original map.

Implementation

@useResult
KtMap<K, V> toMap() {
  if (size == 0) return emptyMap();
  return toMutableMap();
}