Skip to content

Easier loop for maps #4298

@HosseinYousefi

Description

@HosseinYousefi

Currently we can loop over maps via map.entries:

for (final MapEntry(:key, :value) in map.entries) {
  // ...
}

It would be nice to have either a syntax sugar or have Map<K, V> implement Iterable<(K, V)> so that we can do

for (final (key, value) in map) {
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions