Chromium Code Reviews| Index: sdk/lib/_collection_dev/iterable.dart |
| diff --git a/sdk/lib/_collection_dev/iterable.dart b/sdk/lib/_collection_dev/iterable.dart |
| index 6e1e5ecb7c1b79be349de5fd215359d8294a6b0e..2f7746f85def3dd70607e1197333df0541d70892 100644 |
| --- a/sdk/lib/_collection_dev/iterable.dart |
| +++ b/sdk/lib/_collection_dev/iterable.dart |
| @@ -895,6 +895,38 @@ class IterableMixinWorkaround { |
| return buffer.toString(); |
| } |
| + static String toStringIterable(Iterable iterable) { |
| + var result = new StringBuffer(); |
|
floitsch
2013/07/08 12:00:50
Move checking of recursive iterables in here.
zarah
2013/07/08 14:35:15
Done.
|
| + |
| + result.write('{'); |
| + bool first = true; |
| + for (var e in iterable) { |
| + if (!first) { |
| + result.write(', '); |
| + } |
| + first = false; |
| + result.write(e); |
| + } |
| + result.write('}'); |
| + |
| + return result.toString(); |
| + } |
| + |
| + static String toStringList(List list) { |
|
floitsch
2013/07/08 12:00:50
Move checking of recursive lists in here.
zarah
2013/07/08 14:35:15
Done.
|
| + var result = new StringBuffer(); |
| + result.write('['); |
| + for (int i = 0; i < list.length; i++) { |
| + if (i > 0) { |
| + result.write(', '); |
| + } |
| + result.write(list[i]); |
| + } |
| + result.write(']'); |
| + |
| + return result.toString(); |
| + } |
| + |
| + |
| static Iterable where(Iterable iterable, bool f(var element)) { |
| return new WhereIterable(iterable, f); |
| } |
| @@ -982,6 +1014,7 @@ class IterableMixinWorkaround { |
| otherList = from.skip(skipCount).toList(growable: false); |
| otherStart = 0; |
| } |
| + |
| if (otherStart + length > otherList.length) { |
| throw new StateError("Not enough elements"); |
| } |