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

Side by Side Diff: test/generated_sdk/lib/core/list.dart

Issue 1122313002: Typing fixes to eliminate casts/dcalls (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 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
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.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An indexable collection of objects with a length. 8 * An indexable collection of objects with a length.
9 * 9 *
10 * Subclasses of this class implement different kinds of lists. 10 * Subclasses of this class implement different kinds of lists.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 /** 99 /**
100 * Creates a fixed-length list of the given length, and initializes the 100 * Creates a fixed-length list of the given length, and initializes the
101 * value at each position with [fill]: 101 * value at each position with [fill]:
102 * 102 *
103 * new List<int>.filled(3, 0); // [0, 0, 0] 103 * new List<int>.filled(3, 0); // [0, 0, 0]
104 * 104 *
105 * The [length] must not be negative or null. 105 * The [length] must not be negative or null.
106 */ 106 */
107 factory List.filled(int length, E fill) { 107 factory List.filled(int length, E fill) {
108 List result = new List<E>(length); 108 List<E> result = new List<E>(length);
109 if (length != 0 && fill != null) { 109 if (length != 0 && fill != null) {
110 for (int i = 0; i < result.length; i++) { 110 for (int i = 0; i < result.length; i++) {
111 result[i] = fill; 111 result[i] = fill;
112 } 112 }
113 } 113 }
114 return result; 114 return result;
115 } 115 }
116 116
117 /** 117 /**
118 * Creates a list containing all [elements]. 118 * Creates a list containing all [elements].
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 * 741 *
742 * List<String> words = ['fee', 'fi', 'fo', 'fum']; 742 * List<String> words = ['fee', 'fi', 'fo', 'fum'];
743 * Map<int, String> map = words.asMap(); 743 * Map<int, String> map = words.asMap();
744 * map[0] + map[1]; // 'feefi'; 744 * map[0] + map[1]; // 'feefi';
745 * map.keys.toList(); // [0, 1, 2, 3] 745 * map.keys.toList(); // [0, 1, 2, 3]
746 */ 746 */
747 Map<int, E> asMap() { 747 Map<int, E> asMap() {
748 return new IterableMixinWorkaround<E>().asMapList(this); 748 return new IterableMixinWorkaround<E>().asMapList(this);
749 } 749 }
750 } 750 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/collection/splay_tree.dart ('k') | tool/input_sdk/lib/collection/hash_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698