| Index: sdk/lib/collection/collections.dart
|
| diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
|
| index 95b6ddac4320a92c0a50eef3fe36e5dcda9907c5..4bd1fadb513ce5e84a36fbb51ae347e2db93af69 100644
|
| --- a/sdk/lib/collection/collections.dart
|
| +++ b/sdk/lib/collection/collections.dart
|
| @@ -5,11 +5,11 @@
|
| part of dart.collection;
|
|
|
| /**
|
| - * This class provides default implementations for Iterables (including Lists).
|
| - *
|
| - * Once Dart receives Mixins it will be replaced with mixin classes.
|
| + * The [Collections] class implements static methods useful when
|
| + * writing a class that implements [Collection] and the [iterator]
|
| + * method.
|
| */
|
| -class IterableMixinWorkaround {
|
| +class Collections {
|
| static bool contains(Iterable iterable, var element) {
|
| for (final e in iterable) {
|
| if (element == e) return true;
|
| @@ -186,7 +186,7 @@ class IterableMixinWorkaround {
|
| return buffer.toString();
|
| }
|
|
|
| - static String joinList(List list, [String separator]) {
|
| + static String joinList(List<Object> list, [String separator]) {
|
| if (list.isEmpty) return "";
|
| if (list.length == 1) return "${list[0]}";
|
| StringBuffer buffer = new StringBuffer();
|
| @@ -204,146 +204,6 @@ class IterableMixinWorkaround {
|
| return buffer.toString();
|
| }
|
|
|
| - static Iterable where(Iterable iterable, bool f(var element)) {
|
| - return new WhereIterable(iterable, f);
|
| - }
|
| -
|
| - static List mappedByList(List list, f(var element)) {
|
| - return new MappedList(list, f);
|
| - }
|
| -
|
| - static List takeList(List list, int n) {
|
| - // The generic type is currently lost. It will be fixed with mixins.
|
| - return new ListView(list, 0, n);
|
| - }
|
| -
|
| - static Iterable takeWhile(Iterable iterable, bool test(var value)) {
|
| - // The generic type is currently lost. It will be fixed with mixins.
|
| - return new TakeWhileIterable(iterable, test);
|
| - }
|
| -
|
| - static List skipList(List list, int n) {
|
| - // The generic type is currently lost. It will be fixed with mixins.
|
| - return new ListView(list, n, null);
|
| - }
|
| -
|
| - static Iterable skipWhile(Iterable iterable, bool test(var value)) {
|
| - // The generic type is currently lost. It will be fixed with mixins.
|
| - return new SkipWhileIterable(iterable, test);
|
| - }
|
| -}
|
| -
|
| -/**
|
| - * The [Collections] class implements static methods useful when
|
| - * writing a class that implements [Collection] and the [iterator]
|
| - * method.
|
| - */
|
| -class Collections {
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static bool contains(Iterable iterable, var element)
|
| - => IterableMixinWorkaround.contains(iterable, element);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static void forEach(Iterable iterable, void f(o)) {
|
| - IterableMixinWorkaround.forEach(iterable, f);
|
| - }
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static bool any(Iterable iterable, bool f(o))
|
| - => IterableMixinWorkaround.any(iterable, f);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static bool every(Iterable iterable, bool f(o))
|
| - => IterableMixinWorkaround.every(iterable, f);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic reduce(Iterable iterable,
|
| - dynamic initialValue,
|
| - dynamic combine(dynamic previousValue, element))
|
| - => IterableMixinWorkaround.reduce(iterable, initialValue, combine);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static bool isEmpty(Iterable iterable)
|
| - => IterableMixinWorkaround.isEmpty(iterable);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic first(Iterable iterable)
|
| - => IterableMixinWorkaround.first(iterable);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic last(Iterable iterable)
|
| - => IterableMixinWorkaround.last(iterable);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic min(Iterable iterable, [int compare(var a, var b)])
|
| - => IterableMixinWorkaround.min(iterable, compare);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic max(Iterable iterable, [int compare(var a, var b)])
|
| - => IterableMixinWorkaround.max(iterable, compare);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic single(Iterable iterable)
|
| - => IterableMixinWorkaround.single(iterable);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic firstMatching(Iterable iterable,
|
| - bool test(dynamic value),
|
| - dynamic orElse())
|
| - => IterableMixinWorkaround.firstMatching(iterable, test, orElse);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic lastMatching(Iterable iterable,
|
| - bool test(dynamic value),
|
| - dynamic orElse())
|
| - => IterableMixinWorkaround.lastMatching(iterable, test, orElse);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic lastMatchingInList(List list,
|
| - bool test(dynamic value),
|
| - dynamic orElse())
|
| - => IterableMixinWorkaround.lastMatchingInList(list, test, orElse);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic singleMatching(Iterable iterable, bool test(dynamic value))
|
| - => IterableMixinWorkaround.singleMatching(iterable, test);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static dynamic elementAt(Iterable iterable, int index)
|
| - => IterableMixinWorkaround.elementAt(iterable, index);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static String join(Iterable iterable, [String separator])
|
| - => IterableMixinWorkaround.join(iterable, separator);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static String joinList(List list, [String separator])
|
| - => IterableMixinWorkaround.joinList(list, separator);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static Iterable where(Iterable iterable, bool f(var element))
|
| - => IterableMixinWorkaround.where(iterable, f);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static List mappedByList(List list, f(var element))
|
| - => IterableMixinWorkaround.mappedByList(list, f);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static List takeList(List list, int n)
|
| - => IterableMixinWorkaround.takeList(list, n);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static Iterable takeWhile(Iterable iterable, bool test(var value))
|
| - => IterableMixinWorkaround.takeWhile(iterable, test);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static List skipList(List list, int n)
|
| - => IterableMixinWorkaround.skipList(list, n);
|
| -
|
| - /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
|
| - static Iterable skipWhile(Iterable iterable, bool test(var value))
|
| - => IterableMixinWorkaround.skipWhile(iterable, test);
|
| -
|
| // TODO(jjb): visiting list should be an identityHashSet when it exists
|
|
|
| /**
|
|
|