feat(facade/collection): add StringMap support
This commit is contained in:
parent
d4c099de8c
commit
d0c870fb32
|
@ -14,6 +14,17 @@ class MapWrapper {
|
||||||
static int size(m) {return m.length;}
|
static int size(m) {return m.length;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: how to export StringMap=Map as a type?
|
||||||
|
class StringMapWrapper {
|
||||||
|
static HashMap create() => new HashMap();
|
||||||
|
static get(map, key) {
|
||||||
|
return map[key];
|
||||||
|
}
|
||||||
|
static set(map, key, value) {
|
||||||
|
map[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ListWrapper {
|
class ListWrapper {
|
||||||
static List clone(List l) => new List.from(l);
|
static List clone(List l) => new List.from(l);
|
||||||
static List create() => new List();
|
static List create() => new List();
|
||||||
|
|
|
@ -13,6 +13,19 @@ export class MapWrapper {
|
||||||
static size(m) {return m.size;}
|
static size(m) {return m.size;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: cannot export StringMap as a type as Dart does not support
|
||||||
|
// renaming types...
|
||||||
|
export class StringMapWrapper {
|
||||||
|
// Note: We are not using Object.create(null) here due to
|
||||||
|
// performance!
|
||||||
|
static create():Object { return { }; }
|
||||||
|
static get(map, key) {
|
||||||
|
return map.hasOwnProperty(key) ? map[key] : undefined;
|
||||||
|
}
|
||||||
|
static set(map, key, value) {
|
||||||
|
map[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class ListWrapper {
|
export class ListWrapper {
|
||||||
static create():List { return new List(); }
|
static create():List { return new List(); }
|
||||||
|
|
Loading…
Reference in New Issue