| Index: tool/input_sdk/lib/collection/linked_hash_map.dart
|
| diff --git a/tool/input_sdk/lib/collection/linked_hash_map.dart b/tool/input_sdk/lib/collection/linked_hash_map.dart
|
| index e1bca0f509645ba2441fb12b13028ee64768bc1c..3b3d31138eeef5a5e8e161b38e24f6b69e4b0d22 100644
|
| --- a/tool/input_sdk/lib/collection/linked_hash_map.dart
|
| +++ b/tool/input_sdk/lib/collection/linked_hash_map.dart
|
| @@ -43,6 +43,25 @@ abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
|
| * The [isValidKey] function defaults to just testing if the object is a
|
| * [K] instance.
|
| *
|
| + * Example:
|
| + *
|
| + * new LinkedHashMap<int,int>(equals: (int a, int b) => (b - a) % 5 == 0,
|
| + * hashCode: (int e) => e % 5)
|
| + *
|
| + * This example map does not need an `isValidKey` function to be passed.
|
| + * The default function accepts only `int` values, which can safely be
|
| + * passed to both the `equals` and `hashCode` functions.
|
| + *
|
| + * If neither `equals`, `hashCode`, nor `isValidKey` is provided,
|
| + * the default `isValidKey` instead accepts all keys.
|
| + * The default equality and hashcode operations are assumed to work on all
|
| + * objects.
|
| + *
|
| + * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode]
|
| + * and `isValidKey` is omitted, the resulting map is identity based,
|
| + * and the `isValidKey` defaults to accepting all keys.
|
| + * Such a map can be created directly using [LinkedHashMap.identity].
|
| + *
|
| * The used `equals` and `hashCode` method should always be consistent,
|
| * so that if `equals(a, b)` then `hashCode(a) == hashCode(b)`. The hash
|
| * of an object, or what it compares equal to, should not change while the
|
| @@ -50,19 +69,18 @@ abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
|
| *
|
| * If you supply one of [equals] and [hashCode],
|
| * you should generally also to supply the other.
|
| - * An example would be using [identical] and [identityHashCode],
|
| - * which is equivalent to using the shorthand [LinkedHashMap.identity]).
|
| */
|
| - external factory LinkedHashMap({ bool equals(K key1, K key2),
|
| - int hashCode(K key),
|
| - bool isValidKey(potentialKey) });
|
| + external factory LinkedHashMap({bool equals(K key1, K key2),
|
| + int hashCode(K key),
|
| + bool isValidKey(potentialKey)});
|
|
|
| /**
|
| * Creates an insertion-ordered identity-based map.
|
| *
|
| * Effectively a shorthand for:
|
| *
|
| - * new LinkedHashMap(equals: identical, hashCode: identityHashCodeOf)
|
| + * new LinkedHashMap(equals: identical,
|
| + * hashCode: identityHashCode)
|
| */
|
| external factory LinkedHashMap.identity();
|
|
|
| @@ -71,7 +89,7 @@ abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
|
| */
|
| factory LinkedHashMap.from(Map other) {
|
| LinkedHashMap<K, V> result = new LinkedHashMap<K, V>();
|
| - other.forEach((k, v) { result[k] = v; });
|
| + other.forEach((k, v) { result[k as K] = v as V; });
|
| return result;
|
| }
|
|
|
|
|