select method
Selects all entries from the map whose keys are in the provided selectKeys
list.
This method creates a new map containing only the entries with keys present in the selectKeys
list.
The method returns the new map with the selected entries.
selectKeys
The list of keys to be selected from the map.
Returns a map containing only the entries with keys in selectKeys
.
Implementation
Map<K, V> select(List<K> selectKeys) {
Map<K, V> res = {};
for (var entry in entries) {
if (selectKeys.contains(entry.key)) res.add(entry);
}
return res;
}