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

Side by Side Diff: corelib/src/list.dart

Issue 10398052: Fix incorrect range check comments in List.*Range methods' documentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporate comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 ListFactory<E> { 9 interface List<E> extends Collection<E> default ListFactory<E> {
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void add(E value); 46 void add(E value);
47 47
48 /** 48 /**
49 * Adds [value] at the end of the list, extending the length by 49 * Adds [value] at the end of the list, extending the length by
50 * one. Throws an [UnsupportedOperationException] if the list is not 50 * one. Throws an [UnsupportedOperationException] if the list is not
51 * extendable. 51 * extendable.
52 */ 52 */
53 void addLast(E value); 53 void addLast(E value);
54 54
55 /** 55 /**
56 * Appends all elements of the [collection] to the end of list. 56 * Appends all elements of the [collection] to the end of the list.
57 * Extends the length of the list by the length of [collection]. 57 * Extends the length of the list by the length of [collection].
58 * Throws an [UnsupportedOperationException] if the list is not 58 * Throws an [UnsupportedOperationException] if the list is not
59 * extendable. 59 * extendable.
60 */ 60 */
61 void addAll(Collection<E> collection); 61 void addAll(Collection<E> collection);
62 62
63 /** 63 /**
64 * Sorts the list according to the order specified by the comparator. 64 * Sorts the list according to the order specified by the comparator.
65 * The order specified by the comparator must be reflexive, 65 * The order specified by the comparator must be reflexive,
66 * anti-symmetric, and transitive. 66 * anti-symmetric, and transitive.
67 * 67 *
68 * The comparator function [compare] must take two arguments [a] and [b] 68 * The comparator function [compare] must take two arguments [a] and [b]
69 * and return 69 * and return
70 * 70 *
71 * an integer strictly less than 0 if a < b, 71 * an integer strictly less than 0 if a < b,
72 * 0 if a = b, and 72 * 0 if a = b, and
73 * an integer strictly greater than 0 if a > b. 73 * an integer strictly greater than 0 if a > b.
74 */ 74 */
75 void sort(int compare(E a, E b)); 75 void sort(int compare(E a, E b));
76 76
77 /** 77 /**
78 * Returns the first index of [element] in this list. Searches this 78 * Returns the first index of [element] in the list. Searches the
79 * list from index [start] to the length of the list. Returns 79 * list from index [start] to the length of the list. Returns
80 * -1 if [element] is not found. 80 * -1 if [element] is not found.
81 */ 81 */
82 int indexOf(E element, [int start]); 82 int indexOf(E element, [int start]);
83 83
84 /** 84 /**
85 * Returns the last index of [element] in this list. Searches this 85 * Returns the last index of [element] in the list. Searches the
86 * list from index [start] (inclusive) to 0. Returns -1 if 86 * list from index [start] (inclusive) to 0. Returns -1 if
87 * [element] is not found. 87 * [element] is not found.
88 */ 88 */
89 int lastIndexOf(E element, [int start]); 89 int lastIndexOf(E element, [int start]);
90 90
91 /** 91 /**
92 * Removes all elements in the list. The length of the list 92 * Removes all elements in the list. The length of the list
93 * becomes zero. Throws an [UnsupportedOperationException] if 93 * becomes zero. Throws an [UnsupportedOperationException] if
94 * the list is not extendable. 94 * the list is not extendable.
95 */ 95 */
96 void clear(); 96 void clear();
97 97
98 /** 98 /**
99 * Pops and returns the last element of the list. 99 * Pops and returns the last element of the list.
100 * Throws a [UnsupportedOperationException] if the length of the 100 * Throws a [UnsupportedOperationException] if the length of the
101 * list cannot be changed. 101 * list cannot be changed.
102 */ 102 */
103 E removeLast(); 103 E removeLast();
104 104
105 /** 105 /**
106 * Returns the last element of the list, or throws an out of bounds 106 * Returns the last element of the list, or throws an out of bounds
107 * exception if the list is empty. 107 * exception if the list is empty.
108 */ 108 */
109 E last(); 109 E last();
110 110
111 /** 111 /**
112 * Returns a sub list copy of this list, from [start] to 112 * Returns a new list containing [length] elements from the list,
113 * [:start + length:]. 113 * starting at [start].
114 * Returns an empty list if [length] is 0. 114 * Returns an empty list if [length] is 0.
115 * Throws an [IllegalArgumentException] if [length] is negative. 115 * Throws an [IllegalArgumentException] if [length] is negative.
116 * Throws an [IndexOutOfRangeException] if [start] or 116 * Throws an [IndexOutOfRangeException] if [start] or
117 * [:start + length:] are out of range. 117 * [:start + length - 1:] are out of range.
118 */ 118 */
119 List<E> getRange(int start, int length); 119 List<E> getRange(int start, int length);
120 120
121 /** 121 /**
122 * Copies [length] elements of the [from] array, starting 122 * Copies [length] elements of [from], starting
123 * from [startFrom], into [:this:], starting at [start]. 123 * at [startFrom], into the list, starting at [start].
124 * If [length] is 0, this method does not do anything. 124 * If [length] is 0, this method does not do anything.
125 * Throws an [IllegalArgumentException] if [length] is negative. 125 * Throws an [IllegalArgumentException] if [length] is negative.
126 * Throws an [IndexOutOfRangeException] if [start] or 126 * Throws an [IndexOutOfRangeException] if [start] or
127 * [:start + length:] are out of range for [:this:], or if 127 * [:start + length - 1:] are out of range for [:this:], or if
128 * [startFrom] is out of range for [from]. 128 * [startFrom] or [:startFrom + length - 1:] are out of range for [from].
129 */ 129 */
130 void setRange(int start, int length, List<E> from, [int startFrom]); 130 void setRange(int start, int length, List<E> from, [int startFrom]);
131 131
132 /** 132 /**
133 * Removes the range in the list starting from [start] to 133 * Removes [length] elements from the list, beginning at [start].
134 * [:start + length:].
135 * Throws an [UnsupportedOperationException] if the list is 134 * Throws an [UnsupportedOperationException] if the list is
136 * not extendable. 135 * not extendable.
137 * If [length] is 0, this method does not do anything. 136 * If [length] is 0, this method does not do anything.
138 * Throws an [IllegalArgumentException] if [length] is negative. 137 * Throws an [IllegalArgumentException] if [length] is negative.
139 * Throws an [IndexOutOfRangeException] if [start] or 138 * Throws an [IndexOutOfRangeException] if [start] or
140 * [:start + length:] are out of range. 139 * [:start + length: - 1] are out of range.
141 */ 140 */
142 void removeRange(int start, int length); 141 void removeRange(int start, int length);
143 142
144 /** 143 /**
145 * Inserts a new range in the list, starting from [start] to 144 * Inserts a new range into the list, starting from [start] to
146 * [:start + length:]. The entries are filled with [initialValue]. 145 * [:start + length - 1:]. The entries are filled with [initialValue].
147 * Throws an [UnsupportedOperationException] if the list is 146 * Throws an [UnsupportedOperationException] if the list is
148 * not extendable. 147 * not extendable.
149 * If [length] is 0, this method does not do anything. 148 * If [length] is 0, this method does not do anything.
150 * If [start] is the length of the array, this method inserts the 149 * If [start] is the length of the list, this method inserts the
151 * range at the end of the array. 150 * range at the end of the list.
152 * Throws an [IllegalArgumentException] if [length] is negative. 151 * Throws an [IllegalArgumentException] if [length] is negative.
153 * Throws an [IndexOutOfRangeException] if [start] or 152 * Throws an [IndexOutOfRangeException] if [start] is negative or if
154 * [:start + length:] are out of range. 153 * [start] is greater than the length of the list.
155 */ 154 */
156 void insertRange(int start, int length, [E initialValue]); 155 void insertRange(int start, int length, [E initialValue]);
157 } 156 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698