You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Java, the interfaces in the collections library allow that implementors only implement the read-only part of the interface throwing UnsupportedOperationException when calling the mutating part.
The Dart interfaces don't explicitly say this. I believe they should, as it allows implementing immutable collection types that implement the Dart collections interfaces.
/**
* Sets the entry at the given [index] in the list to [value].
* Throws an [IndexOutOfRangeException] if [index] is out of bounds.
*/
void operator []=(int index, E value);
//...
}
/**
* Sets the entry at the given [index] in the list to [value].
* Throws an [IndexOutOfRangeException] if [index] is out of bounds.
* Throws an [UnsupportedOperationException] if the list is immutable.
*/
void operator []=(int index, E value);
//...
}
etc.
The text was updated successfully, but these errors were encountered:
This issue was originally filed by karl.k...@gmail.com
In Java, the interfaces in the collections library allow that implementors only implement the read-only part of the interface throwing UnsupportedOperationException when calling the mutating part.
The Dart interfaces don't explicitly say this. I believe they should, as it allows implementing immutable collection types that implement the Dart collections interfaces.
For example, one might change
interface List<E> extends Collection<E> factory ListFactory {
//...
/**
* Sets the entry at the given [index] in the list to [value].
* Throws an [IndexOutOfRangeException] if [index] is out of bounds.
*/
void operator []=(int index, E value);
//...
}
to
interface List<E> extends Collection<E> factory ListFactory {
//...
/**
* Sets the entry at the given [index] in the list to [value].
* Throws an [IndexOutOfRangeException] if [index] is out of bounds.
* Throws an [UnsupportedOperationException] if the list is immutable.
*/
void operator []=(int index, E value);
//...
}
etc.
The text was updated successfully, but these errors were encountered: