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

Side by Side Diff: tools/dom/src/ImmutableListMixin.dart

Issue 315173005: 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
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.dom.html; 5 part of dart.dom.html;
6 6
7 abstract class ImmutableListMixin<E> implements List<E> { 7 abstract class ImmutableListMixin<E> implements List<E> {
8 // From Iterable<$E>: 8 // From Iterable<$E>:
9 Iterator<E> get iterator { 9 Iterator<E> get iterator {
10 // Note: NodeLists are not fixed size. And most probably length shouldn't 10 // Note: NodeLists are not fixed size. And most probably length shouldn't
11 // be cached in both iterator _and_ forEach method. For now caching it 11 // be cached in both iterator _and_ forEach method. For now caching it
12 // for consistency. 12 // for consistency.
13 return new FixedSizeListIterator<E>(this); 13 return new FixedSizeListIterator<E>(this);
14 } 14 }
15 15
16 // From Collection<E>: 16 // From List<E>:
17 void set last(E value) {
18 throw new UnsupportedError("Cannot modify an immutable List.");
19 }
20
17 void add(E value) { 21 void add(E value) {
18 throw new UnsupportedError("Cannot add to immutable List."); 22 throw new UnsupportedError("Cannot add to immutable List.");
19 } 23 }
20 24
21 void addAll(Iterable<E> iterable) { 25 void addAll(Iterable<E> iterable) {
22 throw new UnsupportedError("Cannot add to immutable List."); 26 throw new UnsupportedError("Cannot add to immutable List.");
23 } 27 }
24 28
25 // From List<E>:
26 void sort([int compare(E a, E b)]) { 29 void sort([int compare(E a, E b)]) {
27 throw new UnsupportedError("Cannot sort immutable List."); 30 throw new UnsupportedError("Cannot sort immutable List.");
28 } 31 }
29 32
30 void shuffle([Random random]) { 33 void shuffle([Random random]) {
31 throw new UnsupportedError("Cannot shuffle immutable List."); 34 throw new UnsupportedError("Cannot shuffle immutable List.");
32 } 35 }
33 36
34 void insert(int index, E element) { 37 void insert(int index, E element) {
35 throw new UnsupportedError("Cannot add to immutable List."); 38 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 75 }
73 76
74 void replaceRange(int start, int end, Iterable<E> iterable) { 77 void replaceRange(int start, int end, Iterable<E> iterable) {
75 throw new UnsupportedError("Cannot modify an immutable List."); 78 throw new UnsupportedError("Cannot modify an immutable List.");
76 } 79 }
77 80
78 void fillRange(int start, int end, [E fillValue]) { 81 void fillRange(int start, int end, [E fillValue]) {
79 throw new UnsupportedError("Cannot modify an immutable List."); 82 throw new UnsupportedError("Cannot modify an immutable List.");
80 } 83 }
81 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698