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

Side by Side Diff: sdk/lib/collection/list.dart

Issue 15263004: Adding isNotEmpty property to collection and string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix template generation Created 7 years, 7 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/collection/linked_hash_set.dart ('k') | sdk/lib/collection/maps.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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; 5 part of dart.collection;
6 6
7 /** 7 /**
8 * Abstract implementation of a list. 8 * Abstract implementation of a list.
9 * 9 *
10 * All operations are defined in terms of `length`, `operator[]`, 10 * All operations are defined in terms of `length`, `operator[]`,
(...skipping 27 matching lines...) Expand all
38 for (int i = 0; i < length; i++) { 38 for (int i = 0; i < length; i++) {
39 action(this[i]); 39 action(this[i]);
40 if (length != this.length) { 40 if (length != this.length) {
41 throw new ConcurrentModificationError(this); 41 throw new ConcurrentModificationError(this);
42 } 42 }
43 } 43 }
44 } 44 }
45 45
46 bool get isEmpty => length == 0; 46 bool get isEmpty => length == 0;
47 47
48 bool get isNotEmpty => !isEmpty;
49
48 E get first { 50 E get first {
49 if (length == 0) throw new StateError("No elements"); 51 if (length == 0) throw new StateError("No elements");
50 return this[0]; 52 return this[0];
51 } 53 }
52 54
53 E get last { 55 E get last {
54 if (length == 0) throw new StateError("No elements"); 56 if (length == 0) throw new StateError("No elements");
55 return this[length - 1]; 57 return this[length - 1];
56 } 58 }
57 59
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 for (E element in iterable) { 472 for (E element in iterable) {
471 this[index++] = element; 473 this[index++] = element;
472 } 474 }
473 } 475 }
474 } 476 }
475 477
476 Iterable<E> get reversed => new ReversedListIterable(this); 478 Iterable<E> get reversed => new ReversedListIterable(this);
477 479
478 String toString() => ToString.iterableToString(this); 480 String toString() => ToString.iterableToString(this);
479 } 481 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/linked_hash_set.dart ('k') | sdk/lib/collection/maps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698