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

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

Issue 12320102: Cleaning up the TableElement API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.dom.html;
6
7 /**
8 * A list which just wraps another list, for either intercepting list calls or
9 * retyping the list (for example, from List<A> to List<B> where B extends A).
10 */
11 class _WrappedList<E> implements List<E> {
12 final List _list;
13
14 _WrappedList(this._list);
15
16 // Iterable APIs
17
18 Iterator<E> get iterator => _list.iterator;
19
20 Iterable map(f(E element)) => _list.map(f);
21
22 Iterable<E> where(bool f(E element)) => _list.where(f);
23
24 Iterable expand(Iterable f(E element)) => _list.expand(f);
25
26 bool contains(E element) => _list.contains(element);
27
28 void forEach(void f(E element)) { _list.forEach(f); }
29
30 dynamic reduce(var initialValue,
31 dynamic combine(var previousValue, E element)) =>
sra1 2013/02/27 03:01:10 you can drop 'dynamic' and 'var'
32 _list.reduce(initialValue, combine);
33
34 bool every(bool f(E element)) => _list.every(f);
35
36 String join([String separator]) => _list.join(separator);
37
38 bool any(bool f(E element)) => _list.any(f);
39
40 List<E> toList() => _list.toList();
sra1 2013/02/27 03:01:10 The type could be wrong here and other methods ret
41
42 Set<E> toSet() => _list.toSet();
43
44 int get length => _list.length;
45
46 E min([int compare(E a, E b)]) => _list.min(compare);
47
48 E max([int compare(E a, E b)]) => _list.max(compare);
49
50 bool get isEmpty => _list.isEmpty;
51
52 Iterable<E> take(int n) => _list.take(n);
53
54 Iterable<E> takeWhile(bool test(E value)) => _list.takeWhile(test);
55
56 Iterable<E> skip(int n) => _list.skip(n);
57
58 Iterable<E> skipWhile(bool test(E value)) => _list.skipWhile(test);
59
60 E get first => _list.first;
61
62 E get last => _list.last;
63
64 E get single => _list.single;
65
66 E firstMatching(bool test(E value), { E orElse() }) =>
67 _list.firstMatching(test, orElse: orElse);
68
69 E lastMatching(bool test(E value), {E orElse()}) =>
70 _list.lastMatching(test, orElse: orElse);
71
72 E singleMatching(bool test(E value)) => _list.singleMatching(test);
73
74 E elementAt(int index) => _list.elementAt(index);
75
76 // Collection APIs
77
78 void add(E element) { _list.add(element); }
79
80 void addAll(Iterable<E> elements) { _list.addAll(elements); }
81
82 void remove(Object element) { _list.remove(element); }
83
84 void removeAll(Iterable elements) { _list.removeAll(elements); }
85
86 void retainAll(Iterable elements) { _list.retainAll(elements); }
87
88 void removeMatching(bool test(E element)) { _list.removeMatching(test); }
89
90 void retainMatching(bool test(E element)) { _list.retainMatching(test); }
91
92 void clear() { _list.clear(); }
93
94 // List APIs
95
96 E operator [](int index) => _list[index];
97
98 void operator []=(int index, E value) { _list[index] = value; }
99
100 void set length(int newLength) { _list.length = newLength; }
101
102 void addLast(E value) { _list.addLast(value); }
103
104 Iterable<E> get reversed => _list.reversed;
105
106 void sort([int compare(E a, E b)]) { _list.sort(compare); }
107
108 int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
109
110 int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
111
112 E removeAt(int index) => _list.removeAt(index);
113
114 E removeLast() => _list.removeLast();
115
116 List<E> getRange(int start, int length) => _list.getRange(start, length);
117
118 void setRange(int start, int length, List<E> from, [int startFrom]) {
119 _list.setRange(start, length, from, startFrom);
120 }
121
122 void removeRange(int start, int length) { _list.removeRange(start, length); }
123
124 void insertRange(int start, int length, [E fill]) {
125 _list.insertRange(start, length, fill);
126 }
127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698