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

Side by Side Diff: sdk/lib/internal/iterable.dart

Issue 207823002: Make generator argument to Iterable.generate optional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed contrustor to not throw on negative count, just cap it to zero. Created 6 years, 9 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
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | tests/corelib/iterable_generate_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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._internal; 5 part of dart._internal;
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 */
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 706
707 Iterable<E> skip(int count) { 707 Iterable<E> skip(int count) {
708 if (count < 0) throw new RangeError.value(count); 708 if (count < 0) throw new RangeError.value(count);
709 return this; 709 return this;
710 } 710 }
711 711
712 Iterable<E> skipWhile(bool test(E element)) => this; 712 Iterable<E> skipWhile(bool test(E element)) => this;
713 713
714 Iterable<E> take(int count) { 714 Iterable<E> take(int count) {
715 if (count < 0) throw new RangeError.value(count); 715 if (count < 0) throw new RangeError.value(count);
716 this; 716 return this;
717 } 717 }
718 718
719 Iterable<E> takeWhile(bool test(E element)) => this; 719 Iterable<E> takeWhile(bool test(E element)) => this;
720 720
721 List toList({ bool growable: true }) => growable ? <E>[] : new List<E>(0); 721 List toList({ bool growable: true }) => growable ? <E>[] : new List<E>(0);
722 722
723 Set toSet() => new Set<E>(); 723 Set toSet() => new Set<E>();
724 } 724 }
725 725
726 /** The always empty iterator. */ 726 /** The always empty iterator. */
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1158
1159 static Set setDifference(Set set, Set other, Set result) { 1159 static Set setDifference(Set set, Set other, Set result) {
1160 for (var element in set) { 1160 for (var element in set) {
1161 if (!other.contains(element)) { 1161 if (!other.contains(element)) {
1162 result.add(element); 1162 result.add(element);
1163 } 1163 }
1164 } 1164 }
1165 return result; 1165 return result;
1166 } 1166 }
1167 } 1167 }
OLDNEW
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | tests/corelib/iterable_generate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698