toMap method

Map<K, V> toMap()

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

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

Implementation

Map<K, V> toMap() {
  return Map.of(this);
}