Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: sdk/lib/core/map.dart

Issue 838463002: Change List/Set/Map/Queue.from constructrs to accept any iterable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An collection of key-value pairs, from which you retrieve a value 8 * An collection of key-value pairs, from which you retrieve a value
9 * using its associated key. 9 * using its associated key.
10 * 10 *
(...skipping 23 matching lines...) Expand all
34 * A `LinkedHashMap` requires the keys to implement compatible 34 * A `LinkedHashMap` requires the keys to implement compatible
35 * `operator==` and `hashCode`, and it allows null as a key. 35 * `operator==` and `hashCode`, and it allows null as a key.
36 * It iterates in key insertion order. 36 * It iterates in key insertion order.
37 */ 37 */
38 factory Map() = LinkedHashMap<K, V>; 38 factory Map() = LinkedHashMap<K, V>;
39 39
40 /** 40 /**
41 * Creates a [LinkedHashMap] instance that contains all key-value pairs of 41 * Creates a [LinkedHashMap] instance that contains all key-value pairs of
42 * [other]. 42 * [other].
43 * 43 *
44 * The keys must all be assignable to [K] and the values to [V].
45 * The [other] map itself can have any type.
46 *
44 * A `LinkedHashMap` requires the keys to implement compatible 47 * A `LinkedHashMap` requires the keys to implement compatible
45 * `operator==` and `hashCode`, and it allows null as a key. 48 * `operator==` and `hashCode`, and it allows null as a key.
46 * It iterates in key insertion order. 49 * It iterates in key insertion order.
47 */ 50 */
48 factory Map.from(Map<K, V> other) = LinkedHashMap<K, V>.from; 51 factory Map.from(Map other) = LinkedHashMap<K, V>.from;
49 52
50 /** 53 /**
51 * Creates an identity map with the default implementation, [LinkedHashMap]. 54 * Creates an identity map with the default implementation, [LinkedHashMap].
52 * 55 *
53 * The returned map allows `null` as a key. 56 * The returned map allows `null` as a key.
54 * It iterates in key insertion order. 57 * It iterates in key insertion order.
55 */ 58 */
56 factory Map.identity() = LinkedHashMap<K, V>.identity; 59 factory Map.identity() = LinkedHashMap<K, V>.identity;
57 60
58 /** 61 /**
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 /** 245 /**
243 * Returns true if there is no key-value pair in the map. 246 * Returns true if there is no key-value pair in the map.
244 */ 247 */
245 bool get isEmpty; 248 bool get isEmpty;
246 249
247 /** 250 /**
248 * Returns true if there is at least one key-value pair in the map. 251 * Returns true if there is at least one key-value pair in the map.
249 */ 252 */
250 bool get isNotEmpty; 253 bool get isNotEmpty;
251 } 254 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698