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

Side by Side Diff: pkg/collection/lib/wrappers.dart

Issue 331833003: Revert "Add "last" setter to List." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « no previous file | pkg/collection/pubspec.yaml » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 * Delegating wrappers for [Iterable], [List], [Set], [Queue] and [Map]. 6 * Delegating wrappers for [Iterable], [List], [Set], [Queue] and [Map].
7 * 7 *
8 * Also adds unmodifiable views for `Set` and `Map`, and a fixed length 8 * Also adds unmodifiable views for `Set` and `Map`, and a fixed length
9 * view for `List`. The unmodifable list view from `dart:collection` is exported 9 * view for `List`. The unmodifable list view from `dart:collection` is exported
10 * as well, just for completeness. 10 * as well, just for completeness.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const DelegatingList(List<E> base) : super(base); 117 const DelegatingList(List<E> base) : super(base);
118 118
119 List<E> get _listBase => _base; 119 List<E> get _listBase => _base;
120 120
121 E operator [](int index) => _listBase[index]; 121 E operator [](int index) => _listBase[index];
122 122
123 void operator []=(int index, E value) { 123 void operator []=(int index, E value) {
124 _listBase[index] = value; 124 _listBase[index] = value;
125 } 125 }
126 126
127 void set last(E value) {
128 _listBase.last = value;
129 }
130
131 void add(E value) { 127 void add(E value) {
132 _listBase.add(value); 128 _listBase.add(value);
133 } 129 }
134 130
135 void addAll(Iterable<E> iterable) { 131 void addAll(Iterable<E> iterable) {
136 _listBase.addAll(iterable); 132 _listBase.addAll(iterable);
137 } 133 }
138 134
139 Map<int, E> asMap() => _listBase.asMap(); 135 Map<int, E> asMap() => _listBase.asMap();
140 136
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 * the elements of [other]. 420 * the elements of [other].
425 * 421 *
426 * Note that the returned set will use the default equality operation, which 422 * Note that the returned set will use the default equality operation, which
427 * may be different than the equality operation [this] uses. 423 * may be different than the equality operation [this] uses.
428 */ 424 */
429 Set<E> union(Set<E> other) => toSet()..addAll(other); 425 Set<E> union(Set<E> other) => toSet()..addAll(other);
430 } 426 }
431 427
432 /** 428 /**
433 * Creates a modifiable [Set] view of the values of a [Map]. 429 * Creates a modifiable [Set] view of the values of a [Map].
434 * 430 *
435 * The `Set` view assumes that the keys of the `Map` can be uniquely determined 431 * The `Set` view assumes that the keys of the `Map` can be uniquely determined
436 * from the values. The `keyForValue` function passed to the constructor finds 432 * from the values. The `keyForValue` function passed to the constructor finds
437 * the key for a single value. The `keyForValue` function should be consistent 433 * the key for a single value. The `keyForValue` function should be consistent
438 * with equality. If `value1 == value2` then `keyForValue(value1)` and 434 * with equality. If `value1 == value2` then `keyForValue(value1)` and
439 * `keyForValue(value2)` should be considered equal keys by the underlying map, 435 * `keyForValue(value2)` should be considered equal keys by the underlying map,
440 * and vice versa. 436 * and vice versa.
441 * 437 *
442 * Modifying the set will modify the underlying map based on the key returned by 438 * Modifying the set will modify the underlying map based on the key returned by
443 * `keyForValue`. 439 * `keyForValue`.
444 * 440 *
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 * Returns a new set which contains all the elements of [this] and [other]. 560 * Returns a new set which contains all the elements of [this] and [other].
565 * 561 *
566 * That is, the returned set contains all the elements of this [Set] and all 562 * That is, the returned set contains all the elements of this [Set] and all
567 * the elements of [other]. 563 * the elements of [other].
568 * 564 *
569 * Note that the returned set will use the default equality operation, which 565 * Note that the returned set will use the default equality operation, which
570 * may be different than the equality operation [this] uses. 566 * may be different than the equality operation [this] uses.
571 */ 567 */
572 Set<V> union(Set<V> other) => toSet()..addAll(other); 568 Set<V> union(Set<V> other) => toSet()..addAll(other);
573 } 569 }
OLDNEW
« no previous file with comments | « no previous file | pkg/collection/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698