operator []= method
Sets the value assocaited with identifier
to value
.
The identifier
must be an index (int) or a label (String).
A RangeError will be thrown if the identifier
isn't a valid
index, or a StateError will be thrown if isn't a valid label.
Implementation
@override
void operator []=(Object identifier, E value) {
assert(identifier is int || identifier is String);
if (identifier is String) {
if (!_labels.contains(identifier)) {
throw StateError('The provided [identifier] isn\'t '
'associated with any element in this list.');
}
elements[_labels.indexOf(identifier)] = value;
return;
}
elements[identifier as int] = value;
}