asMap method Null safety
Return a Map
where the keys are the indices and the values the elements of this set.
Implementation
Map<int, E> asMap() {
Map<int, E> map = Map<int, E>();
for (int i = 0; i < length; i++) map[i] = elementAt(i);
return map;
}