import 'dart:collection'; | |
class NegativeLengthList<E> with ListMixin<E> { | |
final List<E> _list; | |
NegativeLengthList(this._list); | |
int get length => _list.length <= 0 ? -1 : _list.length; | |
void set length(int value) {} | |
E operator [](int index) => _list[index]; | |
void operator []=(int index, E value) {} | |
} | |
int switchList(List<int> list) => switch (list) { | |
[_, _, ...] => 2, | |
[_] => 1, | |
[] => 0, | |
}; | |
main() {} | |
expect(expected, actual) {} |