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

Side by Side Diff: utils/pub/utils.dart

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 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 | « utils/apidoc/mdn/extract.dart ('k') | utils/template/utils.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 /** 5 /**
6 * Generic utility functions. Stuff that should possibly be in core. 6 * Generic utility functions. Stuff that should possibly be in core.
7 */ 7 */
8 library utils; 8 library utils;
9 9
10 import 'dart:crypto'; 10 import 'dart:crypto';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 helper(nested); 68 helper(nested);
69 return result; 69 return result;
70 } 70 }
71 71
72 /** 72 /**
73 * Asserts that [iter] contains only one element, and returns it. 73 * Asserts that [iter] contains only one element, and returns it.
74 */ 74 */
75 only(Iterable iter) { 75 only(Iterable iter) {
76 var iterator = iter.iterator(); 76 var iterator = iter.iterator();
77 assert(iterator.hasNext()); 77 assert(iterator.hasNext);
78 var obj = iterator.next(); 78 var obj = iterator.next();
79 assert(!iterator.hasNext()); 79 assert(!iterator.hasNext);
80 return obj; 80 return obj;
81 } 81 }
82 82
83 /** 83 /**
84 * Returns a set containing all elements in [minuend] that are not in 84 * Returns a set containing all elements in [minuend] that are not in
85 * [subtrahend]. 85 * [subtrahend].
86 */ 86 */
87 Set setMinus(Collection minuend, Collection subtrahend) { 87 Set setMinus(Collection minuend, Collection subtrahend) {
88 var minuendSet = new Set.from(minuend); 88 var minuendSet = new Set.from(minuend);
89 minuendSet.removeAll(subtrahend); 89 minuendSet.removeAll(subtrahend);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 CryptoUtils.bytesToHex(new SHA1().update(source.charCodes()).digest()); 122 CryptoUtils.bytesToHex(new SHA1().update(source.charCodes()).digest());
123 123
124 /** 124 /**
125 * Returns a [Future] that completes in [milliSeconds]. 125 * Returns a [Future] that completes in [milliSeconds].
126 */ 126 */
127 Future sleep(int milliSeconds) { 127 Future sleep(int milliSeconds) {
128 var completer = new Completer(); 128 var completer = new Completer();
129 new Timer(milliSeconds, completer.complete); 129 new Timer(milliSeconds, completer.complete);
130 return completer.future; 130 return completer.future;
131 } 131 }
OLDNEW
« no previous file with comments | « utils/apidoc/mdn/extract.dart ('k') | utils/template/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698