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

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

Issue 11144016: Make argument of List.sort optional with default Comparable.compare. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 * A [List] is an indexable collection with a length. It can be of 6 * A [List] is an indexable collection with a length. It can be of
7 * fixed size or extendable. 7 * fixed size or extendable.
8 */ 8 */
9 interface List<E> extends Collection<E> default ListImplementation<E> { 9 interface List<E> extends Collection<E> default ListImplementation<E> {
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 * Appends all elements of the [collection] to the end of this list. 62 * Appends all elements of the [collection] to the end of this list.
63 * Extends the length of the list by the number of elements in [collection]. 63 * Extends the length of the list by the number of elements in [collection].
64 * Throws an [UnsupportedOperationException] if this list is not 64 * Throws an [UnsupportedOperationException] if this list is not
65 * extendable. 65 * extendable.
66 */ 66 */
67 void addAll(Collection<E> collection); 67 void addAll(Collection<E> collection);
68 68
69 /** 69 /**
70 * Sorts the list according to the order specified by the [Comparator]. 70 * Sorts the list according to the order specified by the [Comparator].
71 */ 71 */
72 void sort(Comparator<E> compare); 72 void sort([Comparator<E> compare = Comparable.compare]);
73 73
74 /** 74 /**
75 * Returns the first index of [element] in the list. 75 * Returns the first index of [element] in the list.
76 * 76 *
77 * Searches the list from index [start] to the length of the list. 77 * Searches the list from index [start] to the length of the list.
78 * The first time an element [:e:] is encountered so that [:e == element:], 78 * The first time an element [:e:] is encountered so that [:e == element:],
79 * the index of [:e:] is returned. 79 * the index of [:e:] is returned.
80 * Returns -1 if [element] is not found. 80 * Returns -1 if [element] is not found.
81 */ 81 */
82 int indexOf(E element, [int start = 0]); 82 int indexOf(E element, [int start = 0]);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 * not extendable. 167 * not extendable.
168 * If [length] is 0, this method does not do anything. 168 * If [length] is 0, this method does not do anything.
169 * If [start] is the length of the list, this method inserts the 169 * If [start] is the length of the list, this method inserts the
170 * range at the end of the list. 170 * range at the end of the list.
171 * Throws an [ArgumentError] if [length] is negative. 171 * Throws an [ArgumentError] if [length] is negative.
172 * Throws an [IndexOutOfRangeException] if [start] is negative or if 172 * Throws an [IndexOutOfRangeException] if [start] is negative or if
173 * [start] is greater than the length of the list. 173 * [start] is greater than the length of the list.
174 */ 174 */
175 void insertRange(int start, int length, [E initialValue]); 175 void insertRange(int start, int length, [E initialValue]);
176 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698