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

Side by Side Diff: pkg/third_party/html5lib/lib/src/list_proxy.dart

Issue 24740003: Add List.shuffle(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adddress comments Created 7 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 // TODO(jmesserly): remove this once we have a subclassable growable list 1 // TODO(jmesserly): remove this once we have a subclassable growable list
2 // in our libraries. 2 // in our libraries.
3 3
4 /** A [List] proxy that you can subclass. */ 4 /** A [List] proxy that you can subclass. */
5 library list_proxy; 5 library list_proxy;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 // TOOD(jmesserly): this needs to be removed, but fixing NodeList is tricky. 9 // TOOD(jmesserly): this needs to be removed, but fixing NodeList is tricky.
10 class ListProxy<E> extends IterableBase<E> implements List<E> { 10 class ListProxy<E> extends IterableBase<E> implements List<E> {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 // From List 45 // From List
46 E operator [](int index) => _list[index]; 46 E operator [](int index) => _list[index];
47 operator []=(int index, E value) { _list[index] = value; } 47 operator []=(int index, E value) { _list[index] = value; }
48 set length(int value) { _list.length = value; } 48 set length(int value) { _list.length = value; }
49 void add(E value) { _list.add(value); } 49 void add(E value) { _list.add(value); }
50 50
51 void addLast(E value) { add(value); } 51 void addLast(E value) { add(value); }
52 void addAll(Iterable<E> collection) { _list.addAll(collection); } 52 void addAll(Iterable<E> collection) { _list.addAll(collection); }
53 void sort([int compare(E a, E b)]) { _list.sort(compare); } 53 void sort([int compare(E a, E b)]) { _list.sort(compare); }
54 void shuffle() { _list.shuffle(); }
54 55
55 int indexOf(E element, [int start = 0]) => _list.indexOf(element, start); 56 int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
56 int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start); 57 int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
57 void clear() { _list.clear(); } 58 void clear() { _list.clear(); }
58 59
59 E removeAt(int index) => _list.removeAt(index); 60 E removeAt(int index) => _list.removeAt(index);
60 E removeLast() => _list.removeLast(); 61 E removeLast() => _list.removeLast();
61 62
62 void removeWhere(bool test(E element)) => _list.removeWhere(test); 63 void removeWhere(bool test(E element)) => _list.removeWhere(test);
63 void retainWhere(bool test(E element)) => _list.retainWhere(test); 64 void retainWhere(bool test(E element)) => _list.retainWhere(test);
(...skipping 15 matching lines...) Expand all
79 Map<int, E> asMap() => _list.asMap(); 80 Map<int, E> asMap() => _list.asMap();
80 81
81 void replaceRange(int start, int end, Iterable<E> newContents) => 82 void replaceRange(int start, int end, Iterable<E> newContents) =>
82 _list.replaceRange(start, end, newContents); 83 _list.replaceRange(start, end, newContents);
83 84
84 void setAll(int index, Iterable<E> iterable) => _list.setAll(index, iterable); 85 void setAll(int index, Iterable<E> iterable) => _list.setAll(index, iterable);
85 86
86 void fillRange(int start, int end, [E fillValue]) 87 void fillRange(int start, int end, [E fillValue])
87 => _list.fillRange(start, end, fillValue); 88 => _list.fillRange(start, end, fillValue);
88 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698