Closed as not planned
Description
Since List<E>
is a generic, where each list element is an object in it will adhere to type E
,
Proposing a generic remove method to make the api more type safe, open to hear about why it was kept this way, and why, if it's better.
abstract class List<E> {
/// proposal
bool remove(E? value);
/// instead of
bool remove(Object? value);
}
- Observed that
indexOf(E element, [int start = 0])
is generic and expects the same typeE
element as inList<E>
- Also noticed that
contains(Object? value)
also usesObject?
param
Why is it better to use Object?
instead of E?
Metadata
Metadata
Assignees
Labels
No labels