OLD | NEW |
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._collection.dev; | 5 part of dart._collection.dev; |
6 | 6 |
7 /** | 7 /** |
8 * Marker interface for [Iterable] subclasses that have an efficient | 8 * Marker interface for [Iterable] subclasses that have an efficient |
9 * [length] implementation. | 9 * [length] implementation. |
10 */ | 10 */ |
11 abstract class EfficientLength { | 11 abstract class EfficientLength { |
12 /** | 12 /** |
13 * Returns the number of elements in the iterable. | 13 * Returns the number of elements in the iterable. |
14 * | 14 * |
15 * This is an efficient operation that doesn't require iterating through | 15 * This is an efficient operation that doesn't require iterating through |
16 * the elements. | 16 * the elements. |
17 */ | 17 */ |
18 int get length; | 18 int get length; |
19 } | 19 } |
20 | 20 |
21 // This is a hack to make @deprecated work in dart:io. Don't remove or use this, | |
22 // unless coordinated with either me or the core library team. Thanks! | |
23 // TODO(ajohnsen): Remove at the 11th of August 2013. | |
24 // TODO(ajohnsen): Remove hide in: | |
25 // tools/dom/templates/html/dart2js/html_dart2js.darttemplate | |
26 // tools/dom/templates/html/dart2js/svg_dart2js.darttemplate | |
27 // tools/dom/templates/html/dart2js/web_audio_dart2js.darttemplate | |
28 // tools/dom/templates/html/dart2js/web_gl_dart2js.darttemplate | |
29 // tools/dom/templates/html/dart2js/web_sql_dart2js.darttemplate | |
30 // tools/dom/templates/html/dartium/html_dartium.darttemplate | |
31 // tools/dom/templates/html/dartium/svg_dartium.darttemplate | |
32 // tools/dom/templates/html/dartium/web_audio_dartium.darttemplate | |
33 // tools/dom/templates/html/dartium/web_gl_dartium.darttemplate | |
34 // tools/dom/templates/html/dartium/web_sql_dartium.darttemplate | |
35 // sdk/lib/core/regexp.dart | |
36 // TODO(floitsch): also used in dart:async until end of September for | |
37 // deprecation of runZonedExperimental. | |
38 // TODO(floitsch): also used in dart:json and dart:utf until middle of October | |
39 // for deprecation of json and utf libraries. | |
40 // TODO(floitsch): and dart:async until middle of October for deprecation of | |
41 // getAttachedStackTrace. | |
42 // TODO(floitsch): and dart:async until end of October for deprecation of | |
43 // runAsync. | |
44 | |
45 // We use a random string constant to avoid it clashing with other constants. | |
46 // This is, because we have a test that verifies that no metadata is included | |
47 // in the output, when no mirrors need them. | |
48 const deprecated = "qB2n4PYM"; | |
49 | |
50 /** | 21 /** |
51 * An [Iterable] for classes that have efficient [length] and [elementAt]. | 22 * An [Iterable] for classes that have efficient [length] and [elementAt]. |
52 * | 23 * |
53 * All other methods are implemented in terms of [length] and [elementAt], | 24 * All other methods are implemented in terms of [length] and [elementAt], |
54 * including [iterator]. | 25 * including [iterator]. |
55 */ | 26 */ |
56 abstract class ListIterable<E> extends IterableBase<E> | 27 abstract class ListIterable<E> extends IterableBase<E> |
57 implements EfficientLength { | 28 implements EfficientLength { |
58 int get length; | 29 int get length; |
59 E elementAt(int i); | 30 E elementAt(int i); |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1158 |
1188 static Set setDifference(Set set, Set other, Set result) { | 1159 static Set setDifference(Set set, Set other, Set result) { |
1189 for (var element in set) { | 1160 for (var element in set) { |
1190 if (!other.contains(element)) { | 1161 if (!other.contains(element)) { |
1191 result.add(element); | 1162 result.add(element); |
1192 } | 1163 } |
1193 } | 1164 } |
1194 return result; | 1165 return result; |
1195 } | 1166 } |
1196 } | 1167 } |
OLD | NEW |