我有一个封装了Map的自定义类,我希望它无需扩展地图即可作为Map:
class TournamentTree<T> {
Map<int, List<Match<T>>> tree = <int, List<Match<T>>>{};
set put (MapEntry<int, List<Match<T>>> entry) => tree[entry.key] = entry.value;
bool get isEmpty => tree.isEmpty;
}
我现在已经创建了那个put方法,但是我想使用这种方式:
tree[0] = matches;
或至少:
tree.put[0] = matches;