| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart.collection; | 5 part of dart.collection; |
| 6 | 6 |
| 7 typedef bool _Predicate<T>(T value); | 7 typedef bool _Predicate<T>(T value); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * A node in a splay tree. It holds the sorting key and the left | 10 * A node in a splay tree. It holds the sorting key and the left |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 * | 282 * |
| 283 * For each element of the [iterable] this constructor computes a key/value | 283 * For each element of the [iterable] this constructor computes a key/value |
| 284 * pair, by applying [key] and [value] respectively. | 284 * pair, by applying [key] and [value] respectively. |
| 285 * | 285 * |
| 286 * The keys of the key/value pairs do not need to be unique. The last | 286 * The keys of the key/value pairs do not need to be unique. The last |
| 287 * occurrence of a key will simply overwrite any previous value. | 287 * occurrence of a key will simply overwrite any previous value. |
| 288 * | 288 * |
| 289 * If no values are specified for [key] and [value] the default is the | 289 * If no values are specified for [key] and [value] the default is the |
| 290 * identity function. | 290 * identity function. |
| 291 */ | 291 */ |
| 292 factory SplayTreeMap.fromIterable(Iterable<K> iterable, | 292 factory SplayTreeMap.fromIterable(Iterable iterable, |
| 293 {K key(element), V value(element), int compare(K key1, K key2), | 293 {K key(element), V value(element), int compare(K key1, K key2), |
| 294 bool isValidKey(potentialKey) }) { | 294 bool isValidKey(potentialKey) }) { |
| 295 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 295 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 296 Maps._fillMapWithMappedIterable(map, iterable, key, value); | 296 Maps._fillMapWithMappedIterable(map, iterable, key, value); |
| 297 return map; | 297 return map; |
| 298 } | 298 } |
| 299 | 299 |
| 300 /** | 300 /** |
| 301 * Creates a [SplayTreeMap] associating the given [keys] to [values]. | 301 * Creates a [SplayTreeMap] associating the given [keys] to [values]. |
| 302 * | 302 * |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left) | 807 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left) |
| 808 ..right = _copyNode(node.right); | 808 ..right = _copyNode(node.right); |
| 809 } | 809 } |
| 810 | 810 |
| 811 void clear() { _clear(); } | 811 void clear() { _clear(); } |
| 812 | 812 |
| 813 Set<E> toSet() => _clone(); | 813 Set<E> toSet() => _clone(); |
| 814 | 814 |
| 815 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | 815 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
| 816 } | 816 } |
| OLD | NEW |