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

Side by Side Diff: sdk/lib/collection/splay_tree.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, 6 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/maps.dart ('k') | sdk/lib/core/iterable.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * A node in a splay tree. It holds the sorting key and the left 8 * A node in a splay tree. It holds the sorting key and the left
9 * and right children in the tree. 9 * and right children in the tree.
10 */ 10 */
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 _addNewRoot(new _SplayTreeMapNode(key, value), comp); 306 _addNewRoot(new _SplayTreeMapNode(key, value), comp);
307 return value; 307 return value;
308 } 308 }
309 309
310 bool get isEmpty { 310 bool get isEmpty {
311 // assert(!((_root == null) && (_count != 0))); 311 // assert(!((_root == null) && (_count != 0)));
312 // assert(!((_count == 0) && (_root != null))); 312 // assert(!((_count == 0) && (_root != null)));
313 return (_root == null); 313 return (_root == null);
314 } 314 }
315 315
316 bool get isNotEmpty => !isEmpty;
317
316 void forEach(void f(K key, V value)) { 318 void forEach(void f(K key, V value)) {
317 Iterator<_SplayTreeNode<K>> nodes = 319 Iterator<_SplayTreeNode<K>> nodes =
318 new _SplayTreeNodeIterator<K>(this); 320 new _SplayTreeNodeIterator<K>(this);
319 while (nodes.moveNext()) { 321 while (nodes.moveNext()) {
320 _SplayTreeMapNode<K, V> node = nodes.current; 322 _SplayTreeMapNode<K, V> node = nodes.current;
321 f(node.key, node.value); 323 f(node.key, node.value);
322 } 324 }
323 } 325 }
324 326
325 int get length { 327 int get length {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> { 531 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {
530 _SplayTreeValueIterator(SplayTreeMap<K, V> map): super(map); 532 _SplayTreeValueIterator(SplayTreeMap<K, V> map): super(map);
531 V _getValue(_SplayTreeMapNode node) => node.value; 533 V _getValue(_SplayTreeMapNode node) => node.value;
532 } 534 }
533 535
534 class _SplayTreeNodeIterator<K> 536 class _SplayTreeNodeIterator<K>
535 extends _SplayTreeIterator<_SplayTreeNode<K>> { 537 extends _SplayTreeIterator<_SplayTreeNode<K>> {
536 _SplayTreeNodeIterator(_SplayTree<K> map): super(map); 538 _SplayTreeNodeIterator(_SplayTree<K> map): super(map);
537 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => node; 539 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => node;
538 } 540 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/maps.dart ('k') | sdk/lib/core/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698