| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 patch class HashMap<K, V> { | 5 patch class HashMap<K, V> { |
| 6 /* patch */ factory HashMap({ bool equals(K key1, K key2), | 6 /* patch */ factory HashMap({ bool equals(K key1, K key2), |
| 7 int hashCode(K key), | 7 int hashCode(K key), |
| 8 bool isValidKey(potentialKey) }) { | 8 bool isValidKey(potentialKey) }) { |
| 9 if (isValidKey == null) { | 9 if (isValidKey == null) { |
| 10 if (hashCode == null) { | 10 if (hashCode == null) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 | 416 |
| 417 class _HashMapEntry { | 417 class _HashMapEntry { |
| 418 final key; | 418 final key; |
| 419 var value; | 419 var value; |
| 420 final int hashCode; | 420 final int hashCode; |
| 421 _HashMapEntry next; | 421 _HashMapEntry next; |
| 422 _HashMapEntry(this.key, this.value, this.hashCode, this.next); | 422 _HashMapEntry(this.key, this.value, this.hashCode, this.next); |
| 423 } | 423 } |
| 424 | 424 |
| 425 abstract class _HashMapIterable<E> extends IterableBase<E> { | 425 abstract class _HashMapIterable<E> extends IterableBase<E> |
| 426 implements EfficientLength { |
| 426 final HashMap _map; | 427 final HashMap _map; |
| 427 _HashMapIterable(this._map); | 428 _HashMapIterable(this._map); |
| 428 int get length => _map.length; | 429 int get length => _map.length; |
| 429 bool get isEmpty => _map.isEmpty; | 430 bool get isEmpty => _map.isEmpty; |
| 430 bool get isNotEmpty => _map.isNotEmpty; | 431 bool get isNotEmpty => _map.isNotEmpty; |
| 431 } | 432 } |
| 432 | 433 |
| 433 class _HashMapKeyIterable<K> extends _HashMapIterable<K> { | 434 class _HashMapKeyIterable<K> extends _HashMapIterable<K> { |
| 434 _HashMapKeyIterable(HashMap map) : super(map); | 435 _HashMapKeyIterable(HashMap map) : super(map); |
| 435 Iterator<K> get iterator => new _HashMapKeyIterator<K>(_map); | 436 Iterator<K> get iterator => new _HashMapKeyIterator<K>(_map); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 var _nextEntry; | 806 var _nextEntry; |
| 806 var _previousEntry; | 807 var _previousEntry; |
| 807 _LinkedHashMapEntry(key, value, int hashCode, _LinkedHashMapEntry next, | 808 _LinkedHashMapEntry(key, value, int hashCode, _LinkedHashMapEntry next, |
| 808 this._previousEntry, this._nextEntry) | 809 this._previousEntry, this._nextEntry) |
| 809 : super(key, value, hashCode, next) { | 810 : super(key, value, hashCode, next) { |
| 810 _previousEntry._nextEntry = this; | 811 _previousEntry._nextEntry = this; |
| 811 _nextEntry._previousEntry = this; | 812 _nextEntry._previousEntry = this; |
| 812 } | 813 } |
| 813 } | 814 } |
| 814 | 815 |
| 815 class _LinkedHashMapKeyIterable<K> extends IterableBase<K> { | 816 class _LinkedHashMapKeyIterable<K> extends IterableBase<K> |
| 817 implements EfficientLength { |
| 816 LinkedHashMap<K, dynamic> _map; | 818 LinkedHashMap<K, dynamic> _map; |
| 817 _LinkedHashMapKeyIterable(this._map); | 819 _LinkedHashMapKeyIterable(this._map); |
| 818 Iterator<K> get iterator => new _LinkedHashMapKeyIterator<K>(_map); | 820 Iterator<K> get iterator => new _LinkedHashMapKeyIterator<K>(_map); |
| 819 bool contains(Object key) => _map.containsKey(key); | 821 bool contains(Object key) => _map.containsKey(key); |
| 820 bool get isEmpty => _map.isEmpty; | 822 bool get isEmpty => _map.isEmpty; |
| 821 bool get isNotEmpty => _map.isNotEmpty; | 823 bool get isNotEmpty => _map.isNotEmpty; |
| 822 int get length => _map.length; | 824 int get length => _map.length; |
| 823 } | 825 } |
| 824 | 826 |
| 825 class _LinkedHashMapValueIterable<V> extends IterableBase<V> { | 827 class _LinkedHashMapValueIterable<V> extends IterableBase<V> |
| 828 implements EfficientLength { |
| 826 LinkedHashMap<dynamic, V> _map; | 829 LinkedHashMap<dynamic, V> _map; |
| 827 _LinkedHashMapValueIterable(this._map); | 830 _LinkedHashMapValueIterable(this._map); |
| 828 Iterator<K> get iterator => new _LinkedHashMapValueIterator<V>(_map); | 831 Iterator<K> get iterator => new _LinkedHashMapValueIterator<V>(_map); |
| 829 bool contains(Object value) => _map.containsValue(value); | 832 bool contains(Object value) => _map.containsValue(value); |
| 830 bool get isEmpty => _map.isEmpty; | 833 bool get isEmpty => _map.isEmpty; |
| 831 bool get isNotEmpty => _map.isNotEmpty; | 834 bool get isNotEmpty => _map.isNotEmpty; |
| 832 int get length => _map.length; | 835 int get length => _map.length; |
| 833 } | 836 } |
| 834 | 837 |
| 835 abstract class _LinkedHashMapIterator<T> implements Iterator<T> { | 838 abstract class _LinkedHashMapIterator<T> implements Iterator<T> { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 return false; | 1231 return false; |
| 1229 } | 1232 } |
| 1230 _LinkedHashSetEntry entry = _next; | 1233 _LinkedHashSetEntry entry = _next; |
| 1231 _current = entry.key; | 1234 _current = entry.key; |
| 1232 _next = entry._nextEntry; | 1235 _next = entry._nextEntry; |
| 1233 return true; | 1236 return true; |
| 1234 } | 1237 } |
| 1235 | 1238 |
| 1236 E get current => _current; | 1239 E get current => _current; |
| 1237 } | 1240 } |
| OLD | NEW |