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

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

Issue 26481002: Change the toString method of IterableBase/IterableMixin to show some elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 2 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/iterable.dart ('k') | sdk/lib/collection/list.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 /** 8 /**
9 * A linked list implementation, providing O(1) removal(unlink) of elements and 9 * A linked list implementation, providing O(1) removal(unlink) of elements and
10 * manual traversal through [next] and [previous]. 10 * manual traversal through [next] and [previous].
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 * If [entry] is not in the list, `false` is returned. 54 * If [entry] is not in the list, `false` is returned.
55 */ 55 */
56 bool remove(E entry) { 56 bool remove(E entry) {
57 if (entry._list != this) return false; 57 if (entry._list != this) return false;
58 _unlink(entry); // Unlink will decrement length. 58 _unlink(entry); // Unlink will decrement length.
59 return true; 59 return true;
60 } 60 }
61 61
62 Iterator<E> get iterator => new _LinkedListIterator<E>(this); 62 Iterator<E> get iterator => new _LinkedListIterator<E>(this);
63 63
64 // TODO(zarah) Remove this, and let it be inherited by IterableMixin
65 String toString() => IterableMixinWorkaround.toStringIterable(this, '{', '}');
66
67 int get length => _length; 64 int get length => _length;
68 65
69 void clear() { 66 void clear() {
70 _modificationCount++; 67 _modificationCount++;
71 _LinkedListLink next = _next; 68 _LinkedListLink next = _next;
72 while (!identical(next, this)) { 69 while (!identical(next, this)) {
73 E entry = next; 70 E entry = next;
74 next = entry._next; 71 next = entry._next;
75 entry._next = entry._previous = entry._list = null; 72 entry._next = entry._previous = entry._list = null;
76 } 73 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 _list._insertAfter(this, entry); 223 _list._insertAfter(this, entry);
227 } 224 }
228 225
229 /** 226 /**
230 * Insert an element before this. 227 * Insert an element before this.
231 */ 228 */
232 void insertBefore(E entry) { 229 void insertBefore(E entry) {
233 _list._insertAfter(_previous, entry); 230 _list._insertAfter(_previous, entry);
234 } 231 }
235 } 232 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/iterable.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698