Chromium Code Reviews| Index: lib/dom/templates/html/impl/impl_Storage.darttemplate | 
| diff --git a/lib/dom/templates/html/impl/impl_Storage.darttemplate b/lib/dom/templates/html/impl/impl_Storage.darttemplate | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..cbba77be33e79fd25d2f5d175cfddf8be439e8b3 | 
| --- /dev/null | 
| +++ b/lib/dom/templates/html/impl/impl_Storage.darttemplate | 
| @@ -0,0 +1,50 @@ | 
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 
| +// for details. All rights reserved. Use of this source code is governed by a | 
| +// BSD-style license that can be found in the LICENSE file. | 
| + | 
| +class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 
| + | 
| + // TODO(nweiz): update this when maps support lazy iteration | 
| + bool containsValue(String value) => getValues().some((e) => e == value); | 
| + | 
| + bool containsKey(String key) => getItem(key) != null; | 
| 
 
Jacob
2012/04/02 21:06:41
you should make getItem private
by adding it to th
 
nweiz
2012/04/02 22:32:14
Done.
 
 | 
| + | 
| + String operator [](String key) => getItem(key); | 
| + | 
| + void operator []=(String key, String value) => setItem(key, value); | 
| + | 
| + String putIfAbsent(String key, String ifAbsent()) { | 
| + if (!containsKey(key)) this[key] = ifAbsent(); | 
| + return this[key]; | 
| + } | 
| + | 
| + String remove(String key) { | 
| + final value = this[key]; | 
| + removeItem(key); | 
| + return value; | 
| + } | 
| + | 
| + void forEach(void f(String key, String value)) { | 
| + for (var i = 0; true; i++) { | 
| + final key = key(i); | 
| + if (key == null) return; | 
| + | 
| + f(key, this[key]); | 
| + } | 
| + } | 
| + | 
| + Collection<String> getKeys() { | 
| + final keys = []; | 
| + forEach((k, v) => keys.add(k)); | 
| + return keys; | 
| + } | 
| + | 
| + Collection<String> getValues() { | 
| + final values = []; | 
| + forEach((k, v) => values.add(v)); | 
| + return values; | 
| + } | 
| + | 
| + bool isEmpty() => key(0) == null; | 
| +$!MEMBERS | 
| +} |