Index: sdk/lib/html/dartium/html_dartium.dart |
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
index b515403b7b54b2cf2cf28174327de3b1bfc01736..cb6dbe2ea3928a043063c4986a49758bbf195732 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -1,10 +1,11 @@ |
library html; |
+import 'dart:async'; |
import 'dart:collection'; |
import 'dart:html_common'; |
import 'dart:indexed_db'; |
import 'dart:isolate'; |
-import 'dart:json'; |
+import 'dart:json' as json; |
import 'dart:nativewrappers'; |
import 'dart:svg' as svg; |
import 'dart:web_audio' as web_audio; |
@@ -54,7 +55,7 @@ var _callPortLastResult = null; |
_callPortSync(num id, var message) { |
if (!_callPortInitialized) { |
window.on['js-result'].add((event) { |
- _callPortLastResult = JSON.parse(_getPortSyncEventData(event)); |
+ _callPortLastResult = json.parse(_getPortSyncEventData(event)); |
}, false); |
_callPortInitialized = true; |
} |
@@ -7063,7 +7064,7 @@ class Document extends Node |
final mutableMatches = $dom_getElementsByName( |
selectors.substring(7,selectors.length - 2)); |
int len = mutableMatches.length; |
- final copyOfMatches = new List<Element>(len); |
+ final copyOfMatches = new List<Element>.fixedLength(len); |
for (int i = 0; i < len; ++i) { |
copyOfMatches[i] = mutableMatches[i]; |
} |
@@ -7071,7 +7072,7 @@ class Document extends Node |
} else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) { |
final mutableMatches = $dom_getElementsByTagName(selectors); |
int len = mutableMatches.length; |
- final copyOfMatches = new List<Element>(len); |
+ final copyOfMatches = new List<Element>.fixedLength(len); |
for (int i = 0; i < len; ++i) { |
copyOfMatches[i] = mutableMatches[i]; |
} |
@@ -7598,27 +7599,13 @@ class DomMimeTypeArray extends NativeFieldWrapperClass1 implements List<DomMimeT |
// From Iterable<DomMimeType>: |
- Iterator<DomMimeType> iterator() { |
+ Iterator<DomMimeType> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<DomMimeType>(this); |
} |
- // From Collection<DomMimeType>: |
- |
- void add(DomMimeType value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(DomMimeType value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<DomMimeType> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -7627,17 +7614,60 @@ class DomMimeTypeArray extends NativeFieldWrapperClass1 implements List<DomMimeT |
void forEach(void f(DomMimeType element)) => Collections.forEach(this, f); |
- Collection map(f(DomMimeType element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(DomMimeType element)) => new MappedList<DomMimeType, dynamic>(this, f); |
- Collection<DomMimeType> filter(bool f(DomMimeType element)) => |
- Collections.filter(this, <DomMimeType>[], f); |
+ Iterable<DomMimeType> where(bool f(DomMimeType element)) => new WhereIterable<DomMimeType>(this, f); |
bool every(bool f(DomMimeType element)) => Collections.every(this, f); |
- bool some(bool f(DomMimeType element)) => Collections.some(this, f); |
+ bool any(bool f(DomMimeType element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<DomMimeType> take(int n) => new ListView<DomMimeType>(this, 0, n); |
+ |
+ Iterable<DomMimeType> takeWhile(bool test(DomMimeType value)) { |
+ return new TakeWhileIterable<DomMimeType>(this, test); |
+ } |
+ |
+ List<DomMimeType> skip(int n) => new ListView<DomMimeType>(this, n, null); |
+ |
+ Iterable<DomMimeType> skipWhile(bool test(DomMimeType value)) { |
+ return new SkipWhileIterable<DomMimeType>(this, test); |
+ } |
+ |
+ DomMimeType firstMatching(bool test(DomMimeType value), { DomMimeType orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ DomMimeType lastMatching(bool test(DomMimeType value), {DomMimeType orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ DomMimeType singleMatching(bool test(DomMimeType value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ DomMimeType elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<DomMimeType>: |
+ |
+ void add(DomMimeType value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(DomMimeType value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<DomMimeType> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<DomMimeType>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -7659,9 +7689,25 @@ class DomMimeTypeArray extends NativeFieldWrapperClass1 implements List<DomMimeT |
return Lists.lastIndexOf(this, element, start); |
} |
- DomMimeType get first => this[0]; |
+ DomMimeType get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ DomMimeType get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ DomMimeType get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ DomMimeType min([int compare(DomMimeType a, DomMimeType b)]) => _Collections.minInList(this, compare); |
- DomMimeType get last => this[length - 1]; |
+ DomMimeType max([int compare(DomMimeType a, DomMimeType b)]) => _Collections.maxInList(this, compare); |
DomMimeType removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -7778,27 +7824,13 @@ class DomPluginArray extends NativeFieldWrapperClass1 implements List<DomPlugin> |
// From Iterable<DomPlugin>: |
- Iterator<DomPlugin> iterator() { |
+ Iterator<DomPlugin> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<DomPlugin>(this); |
} |
- // From Collection<DomPlugin>: |
- |
- void add(DomPlugin value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(DomPlugin value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<DomPlugin> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -7807,17 +7839,60 @@ class DomPluginArray extends NativeFieldWrapperClass1 implements List<DomPlugin> |
void forEach(void f(DomPlugin element)) => Collections.forEach(this, f); |
- Collection map(f(DomPlugin element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<DomPlugin> filter(bool f(DomPlugin element)) => |
- Collections.filter(this, <DomPlugin>[], f); |
+ List mappedBy(f(DomPlugin element)) => new MappedList<DomPlugin, dynamic>(this, f); |
+ |
+ Iterable<DomPlugin> where(bool f(DomPlugin element)) => new WhereIterable<DomPlugin>(this, f); |
bool every(bool f(DomPlugin element)) => Collections.every(this, f); |
- bool some(bool f(DomPlugin element)) => Collections.some(this, f); |
+ bool any(bool f(DomPlugin element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<DomPlugin> take(int n) => new ListView<DomPlugin>(this, 0, n); |
+ |
+ Iterable<DomPlugin> takeWhile(bool test(DomPlugin value)) { |
+ return new TakeWhileIterable<DomPlugin>(this, test); |
+ } |
+ |
+ List<DomPlugin> skip(int n) => new ListView<DomPlugin>(this, n, null); |
+ |
+ Iterable<DomPlugin> skipWhile(bool test(DomPlugin value)) { |
+ return new SkipWhileIterable<DomPlugin>(this, test); |
+ } |
+ |
+ DomPlugin firstMatching(bool test(DomPlugin value), { DomPlugin orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ DomPlugin lastMatching(bool test(DomPlugin value), {DomPlugin orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ DomPlugin singleMatching(bool test(DomPlugin value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ DomPlugin elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<DomPlugin>: |
+ |
+ void add(DomPlugin value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(DomPlugin value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<DomPlugin> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<DomPlugin>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -7839,9 +7914,25 @@ class DomPluginArray extends NativeFieldWrapperClass1 implements List<DomPlugin> |
return Lists.lastIndexOf(this, element, start); |
} |
- DomPlugin get first => this[0]; |
+ DomPlugin get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ DomPlugin get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ DomPlugin get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ DomPlugin min([int compare(DomPlugin a, DomPlugin b)]) => _Collections.minInList(this, compare); |
- DomPlugin get last => this[length - 1]; |
+ DomPlugin max([int compare(DomPlugin a, DomPlugin b)]) => _Collections.maxInList(this, compare); |
DomPlugin removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -8042,27 +8133,13 @@ class DomStringList extends NativeFieldWrapperClass1 implements List<String> { |
// From Iterable<String>: |
- Iterator<String> iterator() { |
+ Iterator<String> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<String>(this); |
} |
- // From Collection<String>: |
- |
- void add(String value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(String value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<String> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -8071,17 +8148,60 @@ class DomStringList extends NativeFieldWrapperClass1 implements List<String> { |
void forEach(void f(String element)) => Collections.forEach(this, f); |
- Collection map(f(String element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); |
- Collection<String> filter(bool f(String element)) => |
- Collections.filter(this, <String>[], f); |
+ Iterable<String> where(bool f(String element)) => new WhereIterable<String>(this, f); |
bool every(bool f(String element)) => Collections.every(this, f); |
- bool some(bool f(String element)) => Collections.some(this, f); |
+ bool any(bool f(String element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<String> take(int n) => new ListView<String>(this, 0, n); |
+ |
+ Iterable<String> takeWhile(bool test(String value)) { |
+ return new TakeWhileIterable<String>(this, test); |
+ } |
+ |
+ List<String> skip(int n) => new ListView<String>(this, n, null); |
+ |
+ Iterable<String> skipWhile(bool test(String value)) { |
+ return new SkipWhileIterable<String>(this, test); |
+ } |
+ |
+ String firstMatching(bool test(String value), { String orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ String lastMatching(bool test(String value), {String orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ String singleMatching(bool test(String value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ String elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<String>: |
+ |
+ void add(String value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(String value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<String> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<String>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -8103,9 +8223,25 @@ class DomStringList extends NativeFieldWrapperClass1 implements List<String> { |
return Lists.lastIndexOf(this, element, start); |
} |
- String get first => this[0]; |
+ String get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ String get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ String get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ String min([int compare(String a, String b)]) => _Collections.minInList(this, compare); |
- String get last => this[length - 1]; |
+ String max([int compare(String a, String b)]) => _Collections.maxInList(this, compare); |
String removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -8212,14 +8348,22 @@ class _ChildrenElementList implements List { |
: _childElements = element.$dom_children, |
_element = element; |
- List<Element> _toList() { |
- final output = new List(_childElements.length); |
+ List<Element> toList() { |
+ final output = new List<Element>.fixedLength(_childElements.length); |
for (int i = 0, len = _childElements.length; i < len; i++) { |
output[i] = _childElements[i]; |
} |
return output; |
} |
+ Set<Element> toSet() { |
+ final output = new Set<Element>(_childElements.length); |
+ for (int i = 0, len = _childElements.length; i < len; i++) { |
+ output.add(_childElements[i]); |
+ } |
+ return output; |
+ } |
+ |
bool contains(Element element) => _childElements.contains(element); |
void forEach(void f(Element element)) { |
@@ -8228,46 +8372,71 @@ class _ChildrenElementList implements List { |
} |
} |
- List<Element> filter(bool f(Element element)) { |
- final output = []; |
- forEach((Element element) { |
- if (f(element)) { |
- output.add(element); |
- } |
- }); |
- return new _FrozenElementList._wrap(output); |
- } |
- |
bool every(bool f(Element element)) { |
for (Element element in this) { |
if (!f(element)) { |
return false; |
} |
- }; |
+ } |
return true; |
} |
- bool some(bool f(Element element)) { |
+ bool any(bool f(Element element)) { |
for (Element element in this) { |
if (f(element)) { |
return true; |
} |
- }; |
+ } |
return false; |
} |
- Collection map(f(Element element)) { |
- final out = []; |
- for (Element el in this) { |
- out.add(f(el)); |
- } |
- return out; |
+ String join([String separator]) { |
+ return Collections.joinList(this, separator); |
+ } |
+ |
+ List mappedBy(f(Element element)) { |
+ return new MappedList<Element, dynamic>(this, f); |
} |
+ Iterable<Element> where(bool f(Element element)) |
+ => new WhereIterable<Element>(this, f); |
+ |
bool get isEmpty { |
return _element.$dom_firstElementChild == null; |
} |
+ List<Element> take(int n) { |
+ return new ListView<Element>(this, 0, n); |
+ } |
+ |
+ Iterable<Element> takeWhile(bool test(Element value)) { |
+ return new TakeWhileIterable<Element>(this, test); |
+ } |
+ |
+ List<Element> skip(int n) { |
+ return new ListView<Element>(this, n, null); |
+ } |
+ |
+ Iterable<Element> skipWhile(bool test(Element value)) { |
+ return new SkipWhileIterable<Element>(this, test); |
+ } |
+ |
+ Element firstMatching(bool test(Element value), {Element orElse()}) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Element lastMatching(bool test(Element value), {Element orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Element singleMatching(bool test(Element value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Element elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
int get length { |
return _childElements.length; |
} |
@@ -8292,10 +8461,10 @@ class _ChildrenElementList implements List { |
Element addLast(Element value) => add(value); |
- Iterator<Element> iterator() => _toList().iterator(); |
+ Iterator<Element> get iterator => toList().iterator; |
- void addAll(Collection<Element> collection) { |
- for (Element element in collection) { |
+ void addAll(Iterable<Element> iterable) { |
+ for (Element element in iterable) { |
_element.$dom_appendChild(element); |
} |
} |
@@ -8356,12 +8525,29 @@ class _ChildrenElementList implements List { |
} |
Element get first { |
- return _element.$dom_firstElementChild; |
+ Element result = _element.$dom_firstElementChild; |
+ if (result == null) throw new StateError("No elements"); |
+ return result; |
} |
Element get last { |
- return _element.$dom_lastElementChild; |
+ Element result = _element.$dom_lastElementChild; |
+ if (result == null) throw new StateError("No elements"); |
+ return result; |
+ } |
+ |
+ Element get single { |
+ if (length > 1) throw new StateError("More than one element"); |
+ return first; |
+ } |
+ |
+ Element min([int compare(Element a, Element b)]) { |
+ return _Collections.minInList(this, compare); |
+ } |
+ |
+ Element max([int compare(Element a, Element b)]) { |
+ return _Collections.maxInList(this, compare); |
} |
} |
@@ -8387,22 +8573,17 @@ class _FrozenElementList implements List { |
} |
} |
- Collection map(f(Element element)) { |
- final out = []; |
- for (Element el in this) { |
- out.add(f(el)); |
- } |
- return out; |
+ String join([String separator]) { |
+ return Collections.joinList(this, separator); |
} |
- List<Element> filter(bool f(Element element)) { |
- final out = []; |
- for (Element el in this) { |
- if (f(el)) out.add(el); |
- } |
- return out; |
+ List mappedBy(f(Element element)) { |
+ return new MappedList<Element, dynamic>(this, f); |
} |
+ Iterable<Element> where(bool f(Element element)) |
+ => new WhereIterable<Element>(this, f); |
+ |
bool every(bool f(Element element)) { |
for(Element element in this) { |
if (!f(element)) { |
@@ -8412,7 +8593,7 @@ class _FrozenElementList implements List { |
return true; |
} |
- bool some(bool f(Element element)) { |
+ bool any(bool f(Element element)) { |
for(Element element in this) { |
if (f(element)) { |
return true; |
@@ -8421,6 +8602,38 @@ class _FrozenElementList implements List { |
return false; |
} |
+ List<Element> take(int n) { |
+ return new ListView<Element>(this, 0, n); |
+ } |
+ |
+ Iterable<Element> takeWhile(bool test(T value)) { |
+ return new TakeWhileIterable<Element>(this, test); |
+ } |
+ |
+ List<Element> skip(int n) { |
+ return new ListView<Element>(this, n, null); |
+ } |
+ |
+ Iterable<Element> skipWhile(bool test(T value)) { |
+ return new SkipWhileIterable<Element>(this, test); |
+ } |
+ |
+ Element firstMatching(bool test(Element value), {Element orElse()}) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Element lastMatching(bool test(Element value), {Element orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Element singleMatching(bool test(Element value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Element elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
bool get isEmpty => _nodeList.isEmpty; |
int get length => _nodeList.length; |
@@ -8443,9 +8656,9 @@ class _FrozenElementList implements List { |
throw new UnsupportedError(''); |
} |
- Iterator<Element> iterator() => new _FrozenElementListIterator(this); |
+ Iterator<Element> get iterator => new _FrozenElementListIterator(this); |
- void addAll(Collection<Element> collection) { |
+ void addAll(Iterable<Element> iterable) { |
throw new UnsupportedError(''); |
} |
@@ -8494,6 +8707,16 @@ class _FrozenElementList implements List { |
Element get first => _nodeList.first; |
Element get last => _nodeList.last; |
+ |
+ Element get single => _nodeList.single; |
+ |
+ Element min([int compare(Element a, Element b)]) { |
+ return _Collections.minInList(this, compare); |
+ } |
+ |
+ Element max([int compare(Element a, Element b)]) { |
+ return _Collections.maxInList(this, compare); |
+ } |
} |
class _FrozenElementListIterator implements Iterator<Element> { |
@@ -8503,21 +8726,28 @@ class _FrozenElementListIterator implements Iterator<Element> { |
_FrozenElementListIterator(this._list); |
/** |
- * Gets the next element in the iteration. Throws a |
- * [StateError("No more elements")] if no element is left. |
+ * Moves to the next element. Returns true if the iterator is positioned |
+ * at an element. Returns false if it is positioned after the last element. |
*/ |
- Element next() { |
- if (!hasNext) { |
- throw new StateError("No more elements"); |
+ bool moveNext() { |
+ int nextIndex = _index + 1; |
+ if (nextIndex < _list.length) { |
+ _current = _list[nextIndex]; |
+ _index = nextIndex; |
+ return true; |
} |
- |
- return _list[_index++]; |
+ _index = _list.length; |
+ _current = null; |
+ return false; |
} |
/** |
- * Returns whether the [Iterator] has elements left. |
+ * Returns the element the [Iterator] is positioned at. |
+ * |
+ * Return [:null:] if the iterator is positioned before the first, or |
+ * after the last element. |
*/ |
- bool get hasNext => _index < _list.length; |
+ E get current => _current; |
} |
class _ElementCssClassSet extends CssClassSet { |
@@ -8541,7 +8771,7 @@ class _ElementCssClassSet extends CssClassSet { |
void writeClasses(Set<String> s) { |
List list = new List.from(s); |
- _element.$dom_className = Strings.join(list, ' '); |
+ _element.$dom_className = s.join(' '); |
} |
} |
@@ -10208,27 +10438,13 @@ class FileList extends NativeFieldWrapperClass1 implements List<File> { |
// From Iterable<File>: |
- Iterator<File> iterator() { |
+ Iterator<File> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<File>(this); |
} |
- // From Collection<File>: |
- |
- void add(File value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(File value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<File> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, File)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -10237,17 +10453,60 @@ class FileList extends NativeFieldWrapperClass1 implements List<File> { |
void forEach(void f(File element)) => Collections.forEach(this, f); |
- Collection map(f(File element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(File element)) => new MappedList<File, dynamic>(this, f); |
- Collection<File> filter(bool f(File element)) => |
- Collections.filter(this, <File>[], f); |
+ Iterable<File> where(bool f(File element)) => new WhereIterable<File>(this, f); |
bool every(bool f(File element)) => Collections.every(this, f); |
- bool some(bool f(File element)) => Collections.some(this, f); |
+ bool any(bool f(File element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<File> take(int n) => new ListView<File>(this, 0, n); |
+ |
+ Iterable<File> takeWhile(bool test(File value)) { |
+ return new TakeWhileIterable<File>(this, test); |
+ } |
+ |
+ List<File> skip(int n) => new ListView<File>(this, n, null); |
+ |
+ Iterable<File> skipWhile(bool test(File value)) { |
+ return new SkipWhileIterable<File>(this, test); |
+ } |
+ |
+ File firstMatching(bool test(File value), { File orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ File lastMatching(bool test(File value), {File orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ File singleMatching(bool test(File value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ File elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<File>: |
+ |
+ void add(File value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(File value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<File> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<File>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -10269,9 +10528,25 @@ class FileList extends NativeFieldWrapperClass1 implements List<File> { |
return Lists.lastIndexOf(this, element, start); |
} |
- File get first => this[0]; |
+ File get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
- File get last => this[length - 1]; |
+ File get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ File get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ File min([int compare(File a, File b)]) => _Collections.minInList(this, compare); |
+ |
+ File max([int compare(File a, File b)]) => _Collections.maxInList(this, compare); |
File removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -10668,27 +10943,13 @@ class Float32Array extends ArrayBufferView implements List<num> { |
// From Iterable<num>: |
- Iterator<num> iterator() { |
+ Iterator<num> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<num>(this); |
} |
- // From Collection<num>: |
- |
- void add(num value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(num value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<num> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -10697,17 +10958,60 @@ class Float32Array extends ArrayBufferView implements List<num> { |
void forEach(void f(num element)) => Collections.forEach(this, f); |
- Collection map(f(num element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<num> filter(bool f(num element)) => |
- Collections.filter(this, <num>[], f); |
+ List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f); |
+ |
+ Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f); |
bool every(bool f(num element)) => Collections.every(this, f); |
- bool some(bool f(num element)) => Collections.some(this, f); |
+ bool any(bool f(num element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<num> take(int n) => new ListView<num>(this, 0, n); |
+ |
+ Iterable<num> takeWhile(bool test(num value)) { |
+ return new TakeWhileIterable<num>(this, test); |
+ } |
+ |
+ List<num> skip(int n) => new ListView<num>(this, n, null); |
+ |
+ Iterable<num> skipWhile(bool test(num value)) { |
+ return new SkipWhileIterable<num>(this, test); |
+ } |
+ |
+ num firstMatching(bool test(num value), { num orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ num lastMatching(bool test(num value), {num orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ num singleMatching(bool test(num value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ num elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<num>: |
+ |
+ void add(num value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(num value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<num> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<num>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -10729,9 +11033,25 @@ class Float32Array extends ArrayBufferView implements List<num> { |
return Lists.lastIndexOf(this, element, start); |
} |
- num get first => this[0]; |
+ num get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ num get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ num get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ num min([int compare(num a, num b)]) => _Collections.minInList(this, compare); |
- num get last => this[length - 1]; |
+ num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare); |
num removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -10816,27 +11136,13 @@ class Float64Array extends ArrayBufferView implements List<num> { |
// From Iterable<num>: |
- Iterator<num> iterator() { |
+ Iterator<num> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<num>(this); |
} |
- // From Collection<num>: |
- |
- void add(num value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(num value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<num> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -10845,17 +11151,60 @@ class Float64Array extends ArrayBufferView implements List<num> { |
void forEach(void f(num element)) => Collections.forEach(this, f); |
- Collection map(f(num element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f); |
- Collection<num> filter(bool f(num element)) => |
- Collections.filter(this, <num>[], f); |
+ Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f); |
bool every(bool f(num element)) => Collections.every(this, f); |
- bool some(bool f(num element)) => Collections.some(this, f); |
+ bool any(bool f(num element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<num> take(int n) => new ListView<num>(this, 0, n); |
+ |
+ Iterable<num> takeWhile(bool test(num value)) { |
+ return new TakeWhileIterable<num>(this, test); |
+ } |
+ |
+ List<num> skip(int n) => new ListView<num>(this, n, null); |
+ |
+ Iterable<num> skipWhile(bool test(num value)) { |
+ return new SkipWhileIterable<num>(this, test); |
+ } |
+ |
+ num firstMatching(bool test(num value), { num orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ num lastMatching(bool test(num value), {num orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ num singleMatching(bool test(num value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ num elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<num>: |
+ |
+ void add(num value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(num value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<num> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<num>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -10877,9 +11226,25 @@ class Float64Array extends ArrayBufferView implements List<num> { |
return Lists.lastIndexOf(this, element, start); |
} |
- num get first => this[0]; |
+ num get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ num get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ num get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ num min([int compare(num a, num b)]) => _Collections.minInList(this, compare); |
- num get last => this[length - 1]; |
+ num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare); |
num removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -11504,27 +11869,13 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 implements List<Node> { |
// From Iterable<Node>: |
- Iterator<Node> iterator() { |
+ Iterator<Node> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Node>(this); |
} |
- // From Collection<Node>: |
- |
- void add(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Node> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -11533,17 +11884,60 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 implements List<Node> { |
void forEach(void f(Node element)) => Collections.forEach(this, f); |
- Collection map(f(Node element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<Node> filter(bool f(Node element)) => |
- Collections.filter(this, <Node>[], f); |
+ List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f); |
+ |
+ Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f); |
bool every(bool f(Node element)) => Collections.every(this, f); |
- bool some(bool f(Node element)) => Collections.some(this, f); |
+ bool any(bool f(Node element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Node> take(int n) => new ListView<Node>(this, 0, n); |
+ |
+ Iterable<Node> takeWhile(bool test(Node value)) { |
+ return new TakeWhileIterable<Node>(this, test); |
+ } |
+ |
+ List<Node> skip(int n) => new ListView<Node>(this, n, null); |
+ |
+ Iterable<Node> skipWhile(bool test(Node value)) { |
+ return new SkipWhileIterable<Node>(this, test); |
+ } |
+ |
+ Node firstMatching(bool test(Node value), { Node orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Node lastMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Node singleMatching(bool test(Node value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Node elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Node>: |
+ |
+ void add(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Node> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Node>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -11565,9 +11959,25 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 implements List<Node> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Node get first => this[0]; |
+ Node get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compare); |
- Node get last => this[length - 1]; |
+ Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compare); |
Node removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -11632,27 +12042,13 @@ class HtmlCollection extends NativeFieldWrapperClass1 implements List<Node> { |
// From Iterable<Node>: |
- Iterator<Node> iterator() { |
+ Iterator<Node> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Node>(this); |
} |
- // From Collection<Node>: |
- |
- void add(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Node> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -11661,17 +12057,60 @@ class HtmlCollection extends NativeFieldWrapperClass1 implements List<Node> { |
void forEach(void f(Node element)) => Collections.forEach(this, f); |
- Collection map(f(Node element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f); |
- Collection<Node> filter(bool f(Node element)) => |
- Collections.filter(this, <Node>[], f); |
+ Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f); |
bool every(bool f(Node element)) => Collections.every(this, f); |
- bool some(bool f(Node element)) => Collections.some(this, f); |
+ bool any(bool f(Node element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Node> take(int n) => new ListView<Node>(this, 0, n); |
+ |
+ Iterable<Node> takeWhile(bool test(Node value)) { |
+ return new TakeWhileIterable<Node>(this, test); |
+ } |
+ |
+ List<Node> skip(int n) => new ListView<Node>(this, n, null); |
+ |
+ Iterable<Node> skipWhile(bool test(Node value)) { |
+ return new SkipWhileIterable<Node>(this, test); |
+ } |
+ |
+ Node firstMatching(bool test(Node value), { Node orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Node lastMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Node singleMatching(bool test(Node value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Node elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Node>: |
+ |
+ void add(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Node> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Node>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -11693,9 +12132,25 @@ class HtmlCollection extends NativeFieldWrapperClass1 implements List<Node> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Node get first => this[0]; |
+ Node get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compare); |
- Node get last => this[length - 1]; |
+ Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compare); |
Node removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -13517,27 +13972,13 @@ class Int16Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -13546,17 +13987,60 @@ class Int16Array extends ArrayBufferView implements List<int> { |
void forEach(void f(int element)) => Collections.forEach(this, f); |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
+ |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
bool every(bool f(int element)) => Collections.every(this, f); |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ bool any(bool f(int element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
+ } |
+ |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
+ } |
+ |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<int>: |
+ |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<int>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -13578,9 +14062,25 @@ class Int16Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -13665,27 +14165,13 @@ class Int32Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -13694,19 +14180,62 @@ class Int32Array extends ArrayBufferView implements List<int> { |
void forEach(void f(int element)) => Collections.forEach(this, f); |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
bool every(bool f(int element)) => Collections.every(this, f); |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ bool any(bool f(int element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
- // From List<int>: |
- void set length(int value) { |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
+ } |
+ |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
+ } |
+ |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<int>: |
+ |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ // From List<int>: |
+ void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
} |
@@ -13726,9 +14255,25 @@ class Int32Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -13813,27 +14358,13 @@ class Int8Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -13842,17 +14373,60 @@ class Int8Array extends ArrayBufferView implements List<int> { |
void forEach(void f(int element)) => Collections.forEach(this, f); |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
+ |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
bool every(bool f(int element)) => Collections.every(this, f); |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ bool any(bool f(int element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
+ } |
+ |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
+ } |
+ |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<int>: |
+ |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<int>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -13874,9 +14448,25 @@ class Int8Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -16139,27 +16729,13 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> { |
// From Iterable<Node>: |
- Iterator<Node> iterator() { |
+ Iterator<Node> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Node>(this); |
} |
- // From Collection<Node>: |
- |
- void add(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Node> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -16168,17 +16744,60 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> { |
void forEach(void f(Node element)) => Collections.forEach(this, f); |
- Collection map(f(Node element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f); |
- Collection<Node> filter(bool f(Node element)) => |
- Collections.filter(this, <Node>[], f); |
+ Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f); |
bool every(bool f(Node element)) => Collections.every(this, f); |
- bool some(bool f(Node element)) => Collections.some(this, f); |
+ bool any(bool f(Node element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Node> take(int n) => new ListView<Node>(this, 0, n); |
+ |
+ Iterable<Node> takeWhile(bool test(Node value)) { |
+ return new TakeWhileIterable<Node>(this, test); |
+ } |
+ |
+ List<Node> skip(int n) => new ListView<Node>(this, n, null); |
+ |
+ Iterable<Node> skipWhile(bool test(Node value)) { |
+ return new SkipWhileIterable<Node>(this, test); |
+ } |
+ |
+ Node firstMatching(bool test(Node value), { Node orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Node lastMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Node singleMatching(bool test(Node value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Node elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Node>: |
+ |
+ void add(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Node> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Node>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -16200,9 +16819,25 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Node get first => this[0]; |
+ Node get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compare); |
- Node get last => this[length - 1]; |
+ Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compare); |
Node removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -16400,8 +17035,30 @@ class _ChildNodeListLazy implements List { |
_ChildNodeListLazy(this._this); |
- Node get first => _this.$dom_firstChild; |
- Node get last => _this.$dom_lastChild; |
+ Node get first { |
+ Node result = _this.$dom_firstChild; |
+ if (result == null) throw new StateError("No elements"); |
+ return result; |
+ } |
+ Node get last { |
+ Node result = _this.$dom_lastChild; |
+ if (result == null) throw new StateError("No elements"); |
+ return result; |
+ } |
+ Node get single { |
+ int l = this.length; |
+ if (l == 0) throw new StateError("No elements"); |
+ if (l > 1) throw new StateError("More than one element"); |
+ return _this.$dom_firstChild; |
+ } |
+ |
+ Node min([int compare(Node a, Node b)]) { |
+ return _Collections.minInList(this, compare); |
+ } |
+ |
+ Node max([int compare(Node a, Node b)]) { |
+ return _Collections.maxInList(this, compare); |
+ } |
void add(Node value) { |
_this.$dom_appendChild(value); |
@@ -16412,8 +17069,8 @@ class _ChildNodeListLazy implements List { |
} |
- void addAll(Collection<Node> collection) { |
- for (Node node in collection) { |
+ void addAll(Iterable<Node> iterable) { |
+ for (Node node in iterable) { |
_this.$dom_appendChild(node); |
} |
} |
@@ -16442,7 +17099,7 @@ class _ChildNodeListLazy implements List { |
_this.$dom_replaceChild(value, this[index]); |
} |
- Iterator<Node> iterator() => _this.$dom_childNodes.iterator(); |
+ Iterator<Node> get iterator => _this.$dom_childNodes.iterator; |
// TODO(jacobr): We can implement these methods much more efficiently by |
// looking up the nodeList only once instead of once per iteration. |
@@ -16455,19 +17112,56 @@ class _ChildNodeListLazy implements List { |
return Collections.reduce(this, initialValue, combine); |
} |
- Collection map(f(Node element)) => Collections.map(this, [], f); |
+ String join([String separator]) { |
+ return Collections.joinList(this, separator); |
+ } |
+ |
+ List mappedBy(f(Node element)) => |
+ new MappedList<Node, dynamic>(this, f); |
- Collection<Node> filter(bool f(Node element)) => |
- Collections.filter(this, <Node>[], f); |
+ Iterable<Node> where(bool f(Node element)) => |
+ new WhereIterable<Node>(this, f); |
bool every(bool f(Node element)) => Collections.every(this, f); |
- bool some(bool f(Node element)) => Collections.some(this, f); |
+ bool any(bool f(Node element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
// From List<Node>: |
+ List<Node> take(int n) { |
+ return new ListView<Node>(this, 0, n); |
+ } |
+ |
+ Iterable<Node> takeWhile(bool test(Node value)) { |
+ return new TakeWhileIterable<Node>(this, test); |
+ } |
+ |
+ List<Node> skip(int n) { |
+ return new ListView<Node>(this, n, null); |
+ } |
+ |
+ Iterable<Node> skipWhile(bool test(Node value)) { |
+ return new SkipWhileIterable<Node>(this, test); |
+ } |
+ |
+ Node firstMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Node lastMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Node singleMatching(bool test(Node value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Node elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
// TODO(jacobr): this could be implemented for child node lists. |
// The exception we throw here is misleading. |
void sort([int compare(Node a, Node b)]) { |
@@ -16809,27 +17503,13 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> { |
// From Iterable<Node>: |
- Iterator<Node> iterator() { |
+ Iterator<Node> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Node>(this); |
} |
- // From Collection<Node>: |
- |
- void add(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Node value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Node> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -16838,17 +17518,60 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> { |
void forEach(void f(Node element)) => Collections.forEach(this, f); |
- Collection map(f(Node element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f); |
- Collection<Node> filter(bool f(Node element)) => |
- Collections.filter(this, <Node>[], f); |
+ Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f); |
bool every(bool f(Node element)) => Collections.every(this, f); |
- bool some(bool f(Node element)) => Collections.some(this, f); |
+ bool any(bool f(Node element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Node> take(int n) => new ListView<Node>(this, 0, n); |
+ |
+ Iterable<Node> takeWhile(bool test(Node value)) { |
+ return new TakeWhileIterable<Node>(this, test); |
+ } |
+ |
+ List<Node> skip(int n) => new ListView<Node>(this, n, null); |
+ |
+ Iterable<Node> skipWhile(bool test(Node value)) { |
+ return new SkipWhileIterable<Node>(this, test); |
+ } |
+ |
+ Node firstMatching(bool test(Node value), { Node orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Node lastMatching(bool test(Node value), {Node orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Node singleMatching(bool test(Node value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Node elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Node>: |
+ |
+ void add(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Node value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Node> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Node>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -16870,9 +17593,25 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Node get first => this[0]; |
+ Node get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Node get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compare); |
- Node get last => this[length - 1]; |
+ Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compare); |
Node removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -19024,13 +19763,13 @@ class SelectElement extends _Element_Merged { |
// Override default options, since IE returns SelectElement itself and it |
// does not operate as a List. |
List<OptionElement> get options { |
- return this.children.filter((e) => e is OptionElement); |
+ return this.children.where((e) => e is OptionElement).toList(); |
} |
List<OptionElement> get selectedOptions { |
// IE does not change the selected flag for single-selection items. |
if (this.multiple) { |
- return this.options.filter((o) => o.selected); |
+ return this.options.where((o) => o.selected).toList(); |
} else { |
return [this.options[this.selectedIndex]]; |
} |
@@ -19241,27 +19980,13 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> { |
// From Iterable<SourceBuffer>: |
- Iterator<SourceBuffer> iterator() { |
+ Iterator<SourceBuffer> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<SourceBuffer>(this); |
} |
- // From Collection<SourceBuffer>: |
- |
- void add(SourceBuffer value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(SourceBuffer value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<SourceBuffer> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -19270,17 +19995,60 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> { |
void forEach(void f(SourceBuffer element)) => Collections.forEach(this, f); |
- Collection map(f(SourceBuffer element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<SourceBuffer> filter(bool f(SourceBuffer element)) => |
- Collections.filter(this, <SourceBuffer>[], f); |
+ List mappedBy(f(SourceBuffer element)) => new MappedList<SourceBuffer, dynamic>(this, f); |
+ |
+ Iterable<SourceBuffer> where(bool f(SourceBuffer element)) => new WhereIterable<SourceBuffer>(this, f); |
bool every(bool f(SourceBuffer element)) => Collections.every(this, f); |
- bool some(bool f(SourceBuffer element)) => Collections.some(this, f); |
+ bool any(bool f(SourceBuffer element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<SourceBuffer> take(int n) => new ListView<SourceBuffer>(this, 0, n); |
+ |
+ Iterable<SourceBuffer> takeWhile(bool test(SourceBuffer value)) { |
+ return new TakeWhileIterable<SourceBuffer>(this, test); |
+ } |
+ |
+ List<SourceBuffer> skip(int n) => new ListView<SourceBuffer>(this, n, null); |
+ |
+ Iterable<SourceBuffer> skipWhile(bool test(SourceBuffer value)) { |
+ return new SkipWhileIterable<SourceBuffer>(this, test); |
+ } |
+ |
+ SourceBuffer firstMatching(bool test(SourceBuffer value), { SourceBuffer orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ SourceBuffer lastMatching(bool test(SourceBuffer value), {SourceBuffer orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ SourceBuffer singleMatching(bool test(SourceBuffer value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ SourceBuffer elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<SourceBuffer>: |
+ |
+ void add(SourceBuffer value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(SourceBuffer value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<SourceBuffer> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<SourceBuffer>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -19302,9 +20070,25 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> { |
return Lists.lastIndexOf(this, element, start); |
} |
- SourceBuffer get first => this[0]; |
+ SourceBuffer get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SourceBuffer get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SourceBuffer get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ SourceBuffer min([int compare(SourceBuffer a, SourceBuffer b)]) => _Collections.minInList(this, compare); |
- SourceBuffer get last => this[length - 1]; |
+ SourceBuffer max([int compare(SourceBuffer a, SourceBuffer b)]) => _Collections.maxInList(this, compare); |
SourceBuffer removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -19463,45 +20247,74 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG |
// From Iterable<SpeechGrammar>: |
- Iterator<SpeechGrammar> iterator() { |
+ Iterator<SpeechGrammar> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<SpeechGrammar>(this); |
} |
- // From Collection<SpeechGrammar>: |
- |
- void add(SpeechGrammar value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) { |
+ return Collections.reduce(this, initialValue, combine); |
} |
- void addLast(SpeechGrammar value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ bool contains(SpeechGrammar element) => Collections.contains(this, element); |
+ |
+ void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f); |
+ |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(SpeechGrammar element)) => new MappedList<SpeechGrammar, dynamic>(this, f); |
+ |
+ Iterable<SpeechGrammar> where(bool f(SpeechGrammar element)) => new WhereIterable<SpeechGrammar>(this, f); |
+ |
+ bool every(bool f(SpeechGrammar element)) => Collections.every(this, f); |
+ |
+ bool any(bool f(SpeechGrammar element)) => Collections.any(this, f); |
+ |
+ bool get isEmpty => this.length == 0; |
+ |
+ List<SpeechGrammar> take(int n) => new ListView<SpeechGrammar>(this, 0, n); |
+ |
+ Iterable<SpeechGrammar> takeWhile(bool test(SpeechGrammar value)) { |
+ return new TakeWhileIterable<SpeechGrammar>(this, test); |
} |
- void addAll(Collection<SpeechGrammar> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ List<SpeechGrammar> skip(int n) => new ListView<SpeechGrammar>(this, n, null); |
+ |
+ Iterable<SpeechGrammar> skipWhile(bool test(SpeechGrammar value)) { |
+ return new SkipWhileIterable<SpeechGrammar>(this, test); |
} |
- dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) { |
- return Collections.reduce(this, initialValue, combine); |
+ SpeechGrammar firstMatching(bool test(SpeechGrammar value), { SpeechGrammar orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
} |
- bool contains(SpeechGrammar element) => Collections.contains(this, element); |
+ SpeechGrammar lastMatching(bool test(SpeechGrammar value), {SpeechGrammar orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
- void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f); |
+ SpeechGrammar singleMatching(bool test(SpeechGrammar value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
- Collection map(f(SpeechGrammar element)) => Collections.map(this, [], f); |
+ SpeechGrammar elementAt(int index) { |
+ return this[index]; |
+ } |
- Collection<SpeechGrammar> filter(bool f(SpeechGrammar element)) => |
- Collections.filter(this, <SpeechGrammar>[], f); |
+ // From Collection<SpeechGrammar>: |
- bool every(bool f(SpeechGrammar element)) => Collections.every(this, f); |
+ void add(SpeechGrammar value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
- bool some(bool f(SpeechGrammar element)) => Collections.some(this, f); |
+ void addLast(SpeechGrammar value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
- bool get isEmpty => this.length == 0; |
+ void addAll(Iterable<SpeechGrammar> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
// From List<SpeechGrammar>: |
void set length(int value) { |
@@ -19524,9 +20337,25 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG |
return Lists.lastIndexOf(this, element, start); |
} |
- SpeechGrammar get first => this[0]; |
+ SpeechGrammar get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SpeechGrammar get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
- SpeechGrammar get last => this[length - 1]; |
+ SpeechGrammar get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ SpeechGrammar min([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collections.minInList(this, compare); |
+ |
+ SpeechGrammar max([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collections.maxInList(this, compare); |
SpeechGrammar removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -19962,27 +20791,13 @@ class SqlResultSetRowList extends NativeFieldWrapperClass1 implements List<Map> |
// From Iterable<Map>: |
- Iterator<Map> iterator() { |
+ Iterator<Map> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Map>(this); |
} |
- // From Collection<Map>: |
- |
- void add(Map value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Map value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Map> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Map)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -19991,17 +20806,60 @@ class SqlResultSetRowList extends NativeFieldWrapperClass1 implements List<Map> |
void forEach(void f(Map element)) => Collections.forEach(this, f); |
- Collection map(f(Map element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(Map element)) => new MappedList<Map, dynamic>(this, f); |
- Collection<Map> filter(bool f(Map element)) => |
- Collections.filter(this, <Map>[], f); |
+ Iterable<Map> where(bool f(Map element)) => new WhereIterable<Map>(this, f); |
bool every(bool f(Map element)) => Collections.every(this, f); |
- bool some(bool f(Map element)) => Collections.some(this, f); |
+ bool any(bool f(Map element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Map> take(int n) => new ListView<Map>(this, 0, n); |
+ |
+ Iterable<Map> takeWhile(bool test(Map value)) { |
+ return new TakeWhileIterable<Map>(this, test); |
+ } |
+ |
+ List<Map> skip(int n) => new ListView<Map>(this, n, null); |
+ |
+ Iterable<Map> skipWhile(bool test(Map value)) { |
+ return new SkipWhileIterable<Map>(this, test); |
+ } |
+ |
+ Map firstMatching(bool test(Map value), { Map orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Map lastMatching(bool test(Map value), {Map orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Map singleMatching(bool test(Map value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Map elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Map>: |
+ |
+ void add(Map value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Map value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Map> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Map>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -20023,9 +20881,25 @@ class SqlResultSetRowList extends NativeFieldWrapperClass1 implements List<Map> |
return Lists.lastIndexOf(this, element, start); |
} |
- Map get first => this[0]; |
+ Map get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Map get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Map get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Map min([int compare(Map a, Map b)]) => _Collections.minInList(this, compare); |
- Map get last => this[length - 1]; |
+ Map max([int compare(Map a, Map b)]) => _Collections.maxInList(this, compare); |
Map removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -20098,7 +20972,7 @@ class SqlTransactionSync extends NativeFieldWrapperClass1 { |
class Storage extends NativeFieldWrapperClass1 implements Map<String, String> { |
// TODO(nweiz): update this when maps support lazy iteration |
- bool containsValue(String value) => values.some((e) => e == value); |
+ bool containsValue(String value) => values.any((e) => e == value); |
bool containsKey(String key) => $dom_getItem(key) != null; |
@@ -21134,27 +22008,13 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac |
// From Iterable<TextTrackCue>: |
- Iterator<TextTrackCue> iterator() { |
+ Iterator<TextTrackCue> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<TextTrackCue>(this); |
} |
- // From Collection<TextTrackCue>: |
- |
- void add(TextTrackCue value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(TextTrackCue value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<TextTrackCue> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -21163,17 +22023,60 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac |
void forEach(void f(TextTrackCue element)) => Collections.forEach(this, f); |
- Collection map(f(TextTrackCue element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(TextTrackCue element)) => new MappedList<TextTrackCue, dynamic>(this, f); |
- Collection<TextTrackCue> filter(bool f(TextTrackCue element)) => |
- Collections.filter(this, <TextTrackCue>[], f); |
+ Iterable<TextTrackCue> where(bool f(TextTrackCue element)) => new WhereIterable<TextTrackCue>(this, f); |
bool every(bool f(TextTrackCue element)) => Collections.every(this, f); |
- bool some(bool f(TextTrackCue element)) => Collections.some(this, f); |
+ bool any(bool f(TextTrackCue element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<TextTrackCue> take(int n) => new ListView<TextTrackCue>(this, 0, n); |
+ |
+ Iterable<TextTrackCue> takeWhile(bool test(TextTrackCue value)) { |
+ return new TakeWhileIterable<TextTrackCue>(this, test); |
+ } |
+ |
+ List<TextTrackCue> skip(int n) => new ListView<TextTrackCue>(this, n, null); |
+ |
+ Iterable<TextTrackCue> skipWhile(bool test(TextTrackCue value)) { |
+ return new SkipWhileIterable<TextTrackCue>(this, test); |
+ } |
+ |
+ TextTrackCue firstMatching(bool test(TextTrackCue value), { TextTrackCue orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ TextTrackCue lastMatching(bool test(TextTrackCue value), {TextTrackCue orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ TextTrackCue singleMatching(bool test(TextTrackCue value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ TextTrackCue elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<TextTrackCue>: |
+ |
+ void add(TextTrackCue value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(TextTrackCue value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<TextTrackCue> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<TextTrackCue>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -21195,9 +22098,25 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac |
return Lists.lastIndexOf(this, element, start); |
} |
- TextTrackCue get first => this[0]; |
+ TextTrackCue get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
- TextTrackCue get last => this[length - 1]; |
+ TextTrackCue get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ TextTrackCue get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ TextTrackCue min([int compare(TextTrackCue a, TextTrackCue b)]) => _Collections.minInList(this, compare); |
+ |
+ TextTrackCue max([int compare(TextTrackCue a, TextTrackCue b)]) => _Collections.maxInList(this, compare); |
TextTrackCue removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -21262,27 +22181,13 @@ class TextTrackList extends EventTarget implements List<TextTrack> { |
// From Iterable<TextTrack>: |
- Iterator<TextTrack> iterator() { |
+ Iterator<TextTrack> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<TextTrack>(this); |
} |
- // From Collection<TextTrack>: |
- |
- void add(TextTrack value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(TextTrack value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<TextTrack> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrack)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -21291,17 +22196,60 @@ class TextTrackList extends EventTarget implements List<TextTrack> { |
void forEach(void f(TextTrack element)) => Collections.forEach(this, f); |
- Collection map(f(TextTrack element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(TextTrack element)) => new MappedList<TextTrack, dynamic>(this, f); |
- Collection<TextTrack> filter(bool f(TextTrack element)) => |
- Collections.filter(this, <TextTrack>[], f); |
+ Iterable<TextTrack> where(bool f(TextTrack element)) => new WhereIterable<TextTrack>(this, f); |
bool every(bool f(TextTrack element)) => Collections.every(this, f); |
- bool some(bool f(TextTrack element)) => Collections.some(this, f); |
+ bool any(bool f(TextTrack element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<TextTrack> take(int n) => new ListView<TextTrack>(this, 0, n); |
+ |
+ Iterable<TextTrack> takeWhile(bool test(TextTrack value)) { |
+ return new TakeWhileIterable<TextTrack>(this, test); |
+ } |
+ |
+ List<TextTrack> skip(int n) => new ListView<TextTrack>(this, n, null); |
+ |
+ Iterable<TextTrack> skipWhile(bool test(TextTrack value)) { |
+ return new SkipWhileIterable<TextTrack>(this, test); |
+ } |
+ |
+ TextTrack firstMatching(bool test(TextTrack value), { TextTrack orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ TextTrack lastMatching(bool test(TextTrack value), {TextTrack orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ TextTrack singleMatching(bool test(TextTrack value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ TextTrack elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<TextTrack>: |
+ |
+ void add(TextTrack value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(TextTrack value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<TextTrack> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<TextTrack>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -21323,9 +22271,25 @@ class TextTrackList extends EventTarget implements List<TextTrack> { |
return Lists.lastIndexOf(this, element, start); |
} |
- TextTrack get first => this[0]; |
+ TextTrack get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ TextTrack get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ TextTrack get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
- TextTrack get last => this[length - 1]; |
+ TextTrack min([int compare(TextTrack a, TextTrack b)]) => _Collections.minInList(this, compare); |
+ |
+ TextTrack max([int compare(TextTrack a, TextTrack b)]) => _Collections.maxInList(this, compare); |
TextTrack removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -21554,27 +22518,13 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> { |
// From Iterable<Touch>: |
- Iterator<Touch> iterator() { |
+ Iterator<Touch> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Touch>(this); |
} |
- // From Collection<Touch>: |
- |
- void add(Touch value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Touch value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Touch> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Touch)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -21583,17 +22533,60 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> { |
void forEach(void f(Touch element)) => Collections.forEach(this, f); |
- Collection map(f(Touch element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<Touch> filter(bool f(Touch element)) => |
- Collections.filter(this, <Touch>[], f); |
+ List mappedBy(f(Touch element)) => new MappedList<Touch, dynamic>(this, f); |
+ |
+ Iterable<Touch> where(bool f(Touch element)) => new WhereIterable<Touch>(this, f); |
bool every(bool f(Touch element)) => Collections.every(this, f); |
- bool some(bool f(Touch element)) => Collections.some(this, f); |
+ bool any(bool f(Touch element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Touch> take(int n) => new ListView<Touch>(this, 0, n); |
+ |
+ Iterable<Touch> takeWhile(bool test(Touch value)) { |
+ return new TakeWhileIterable<Touch>(this, test); |
+ } |
+ |
+ List<Touch> skip(int n) => new ListView<Touch>(this, n, null); |
+ |
+ Iterable<Touch> skipWhile(bool test(Touch value)) { |
+ return new SkipWhileIterable<Touch>(this, test); |
+ } |
+ |
+ Touch firstMatching(bool test(Touch value), { Touch orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Touch lastMatching(bool test(Touch value), {Touch orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Touch singleMatching(bool test(Touch value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Touch elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Touch>: |
+ |
+ void add(Touch value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Touch value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Touch> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Touch>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -21615,9 +22608,25 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Touch get first => this[0]; |
+ Touch get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
- Touch get last => this[length - 1]; |
+ Touch get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Touch get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Touch min([int compare(Touch a, Touch b)]) => _Collections.minInList(this, compare); |
+ |
+ Touch max([int compare(Touch a, Touch b)]) => _Collections.maxInList(this, compare); |
Touch removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -21945,27 +22954,13 @@ class Uint16Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -21974,17 +22969,60 @@ class Uint16Array extends ArrayBufferView implements List<int> { |
void forEach(void f(int element)) => Collections.forEach(this, f); |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
bool every(bool f(int element)) => Collections.every(this, f); |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ bool any(bool f(int element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
+ } |
+ |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
+ } |
+ |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<int>: |
+ |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<int>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -22006,9 +23044,25 @@ class Uint16Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -22093,27 +23147,13 @@ class Uint32Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -22122,17 +23162,60 @@ class Uint32Array extends ArrayBufferView implements List<int> { |
void forEach(void f(int element)) => Collections.forEach(this, f); |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
bool every(bool f(int element)) => Collections.every(this, f); |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ bool any(bool f(int element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
+ } |
+ |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
+ } |
+ |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<int>: |
+ |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<int>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -22154,9 +23237,25 @@ class Uint32Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -22241,45 +23340,74 @@ class Uint8Array extends ArrayBufferView implements List<int> { |
// From Iterable<int>: |
- Iterator<int> iterator() { |
+ Iterator<int> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<int>(this); |
} |
- // From Collection<int>: |
- |
- void add(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
+ return Collections.reduce(this, initialValue, combine); |
} |
- void addLast(int value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ bool contains(int element) => Collections.contains(this, element); |
+ |
+ void forEach(void f(int element)) => Collections.forEach(this, f); |
+ |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f); |
+ |
+ Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f); |
+ |
+ bool every(bool f(int element)) => Collections.every(this, f); |
+ |
+ bool any(bool f(int element)) => Collections.any(this, f); |
+ |
+ bool get isEmpty => this.length == 0; |
+ |
+ List<int> take(int n) => new ListView<int>(this, 0, n); |
+ |
+ Iterable<int> takeWhile(bool test(int value)) { |
+ return new TakeWhileIterable<int>(this, test); |
} |
- void addAll(Collection<int> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
+ List<int> skip(int n) => new ListView<int>(this, n, null); |
+ |
+ Iterable<int> skipWhile(bool test(int value)) { |
+ return new SkipWhileIterable<int>(this, test); |
} |
- dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { |
- return Collections.reduce(this, initialValue, combine); |
+ int firstMatching(bool test(int value), { int orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
} |
- bool contains(int element) => Collections.contains(this, element); |
+ int lastMatching(bool test(int value), {int orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
- void forEach(void f(int element)) => Collections.forEach(this, f); |
+ int singleMatching(bool test(int value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
- Collection map(f(int element)) => Collections.map(this, [], f); |
+ int elementAt(int index) { |
+ return this[index]; |
+ } |
- Collection<int> filter(bool f(int element)) => |
- Collections.filter(this, <int>[], f); |
+ // From Collection<int>: |
- bool every(bool f(int element)) => Collections.every(this, f); |
+ void add(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
- bool some(bool f(int element)) => Collections.some(this, f); |
+ void addLast(int value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
- bool get isEmpty => this.length == 0; |
+ void addAll(Iterable<int> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
// From List<int>: |
void set length(int value) { |
@@ -22302,9 +23430,25 @@ class Uint8Array extends ArrayBufferView implements List<int> { |
return Lists.lastIndexOf(this, element, start); |
} |
- int get first => this[0]; |
+ int get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ int get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ int min([int compare(int a, int b)]) => _Collections.minInList(this, compare); |
- int get last => this[length - 1]; |
+ int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare); |
int removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -24506,7 +25650,7 @@ class Window extends EventTarget implements WindowBase { |
* registered under [name]. |
*/ |
lookupPort(String name) { |
- var port = JSON.parse(document.documentElement.attributes['dart-port:$name']); |
+ var port = json.parse(document.documentElement.attributes['dart-port:$name']); |
return _deserialize(port); |
} |
@@ -24517,7 +25661,7 @@ class Window extends EventTarget implements WindowBase { |
*/ |
registerPort(String name, var port) { |
var serialized = _serialize(port); |
- document.documentElement.attributes['dart-port:$name'] = JSON.stringify(serialized); |
+ document.documentElement.attributes['dart-port:$name'] = json.stringify(serialized); |
} |
Window.internal() : super.internal(); |
@@ -25614,27 +26758,13 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec |
// From Iterable<ClientRect>: |
- Iterator<ClientRect> iterator() { |
+ Iterator<ClientRect> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<ClientRect>(this); |
} |
- // From Collection<ClientRect>: |
- |
- void add(ClientRect value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(ClientRect value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<ClientRect> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ClientRect)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -25643,17 +26773,60 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec |
void forEach(void f(ClientRect element)) => Collections.forEach(this, f); |
- Collection map(f(ClientRect element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(ClientRect element)) => new MappedList<ClientRect, dynamic>(this, f); |
- Collection<ClientRect> filter(bool f(ClientRect element)) => |
- Collections.filter(this, <ClientRect>[], f); |
+ Iterable<ClientRect> where(bool f(ClientRect element)) => new WhereIterable<ClientRect>(this, f); |
bool every(bool f(ClientRect element)) => Collections.every(this, f); |
- bool some(bool f(ClientRect element)) => Collections.some(this, f); |
+ bool any(bool f(ClientRect element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<ClientRect> take(int n) => new ListView<ClientRect>(this, 0, n); |
+ |
+ Iterable<ClientRect> takeWhile(bool test(ClientRect value)) { |
+ return new TakeWhileIterable<ClientRect>(this, test); |
+ } |
+ |
+ List<ClientRect> skip(int n) => new ListView<ClientRect>(this, n, null); |
+ |
+ Iterable<ClientRect> skipWhile(bool test(ClientRect value)) { |
+ return new SkipWhileIterable<ClientRect>(this, test); |
+ } |
+ |
+ ClientRect firstMatching(bool test(ClientRect value), { ClientRect orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ ClientRect lastMatching(bool test(ClientRect value), {ClientRect orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ ClientRect singleMatching(bool test(ClientRect value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ ClientRect elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<ClientRect>: |
+ |
+ void add(ClientRect value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(ClientRect value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<ClientRect> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<ClientRect>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -25675,9 +26848,25 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec |
return Lists.lastIndexOf(this, element, start); |
} |
- ClientRect get first => this[0]; |
+ ClientRect get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ ClientRect get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ ClientRect get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ ClientRect min([int compare(ClientRect a, ClientRect b)]) => _Collections.minInList(this, compare); |
- ClientRect get last => this[length - 1]; |
+ ClientRect max([int compare(ClientRect a, ClientRect b)]) => _Collections.maxInList(this, compare); |
ClientRect removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -25734,27 +26923,13 @@ class _CssRuleList extends NativeFieldWrapperClass1 implements List<CssRule> { |
// From Iterable<CssRule>: |
- Iterator<CssRule> iterator() { |
+ Iterator<CssRule> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<CssRule>(this); |
} |
- // From Collection<CssRule>: |
- |
- void add(CssRule value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(CssRule value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<CssRule> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssRule)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -25763,17 +26938,60 @@ class _CssRuleList extends NativeFieldWrapperClass1 implements List<CssRule> { |
void forEach(void f(CssRule element)) => Collections.forEach(this, f); |
- Collection map(f(CssRule element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<CssRule> filter(bool f(CssRule element)) => |
- Collections.filter(this, <CssRule>[], f); |
+ List mappedBy(f(CssRule element)) => new MappedList<CssRule, dynamic>(this, f); |
+ |
+ Iterable<CssRule> where(bool f(CssRule element)) => new WhereIterable<CssRule>(this, f); |
bool every(bool f(CssRule element)) => Collections.every(this, f); |
- bool some(bool f(CssRule element)) => Collections.some(this, f); |
+ bool any(bool f(CssRule element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<CssRule> take(int n) => new ListView<CssRule>(this, 0, n); |
+ |
+ Iterable<CssRule> takeWhile(bool test(CssRule value)) { |
+ return new TakeWhileIterable<CssRule>(this, test); |
+ } |
+ |
+ List<CssRule> skip(int n) => new ListView<CssRule>(this, n, null); |
+ |
+ Iterable<CssRule> skipWhile(bool test(CssRule value)) { |
+ return new SkipWhileIterable<CssRule>(this, test); |
+ } |
+ |
+ CssRule firstMatching(bool test(CssRule value), { CssRule orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ CssRule lastMatching(bool test(CssRule value), {CssRule orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ CssRule singleMatching(bool test(CssRule value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ CssRule elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<CssRule>: |
+ |
+ void add(CssRule value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(CssRule value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<CssRule> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<CssRule>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -25795,9 +27013,25 @@ class _CssRuleList extends NativeFieldWrapperClass1 implements List<CssRule> { |
return Lists.lastIndexOf(this, element, start); |
} |
- CssRule get first => this[0]; |
+ CssRule get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ CssRule get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ CssRule get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ CssRule min([int compare(CssRule a, CssRule b)]) => _Collections.minInList(this, compare); |
- CssRule get last => this[length - 1]; |
+ CssRule max([int compare(CssRule a, CssRule b)]) => _Collections.maxInList(this, compare); |
CssRule removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -25854,27 +27088,13 @@ class _CssValueList extends CssValue implements List<CssValue> { |
// From Iterable<CssValue>: |
- Iterator<CssValue> iterator() { |
+ Iterator<CssValue> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<CssValue>(this); |
} |
- // From Collection<CssValue>: |
- |
- void add(CssValue value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(CssValue value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<CssValue> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssValue)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -25883,17 +27103,60 @@ class _CssValueList extends CssValue implements List<CssValue> { |
void forEach(void f(CssValue element)) => Collections.forEach(this, f); |
- Collection map(f(CssValue element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(CssValue element)) => new MappedList<CssValue, dynamic>(this, f); |
- Collection<CssValue> filter(bool f(CssValue element)) => |
- Collections.filter(this, <CssValue>[], f); |
+ Iterable<CssValue> where(bool f(CssValue element)) => new WhereIterable<CssValue>(this, f); |
bool every(bool f(CssValue element)) => Collections.every(this, f); |
- bool some(bool f(CssValue element)) => Collections.some(this, f); |
+ bool any(bool f(CssValue element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<CssValue> take(int n) => new ListView<CssValue>(this, 0, n); |
+ |
+ Iterable<CssValue> takeWhile(bool test(CssValue value)) { |
+ return new TakeWhileIterable<CssValue>(this, test); |
+ } |
+ |
+ List<CssValue> skip(int n) => new ListView<CssValue>(this, n, null); |
+ |
+ Iterable<CssValue> skipWhile(bool test(CssValue value)) { |
+ return new SkipWhileIterable<CssValue>(this, test); |
+ } |
+ |
+ CssValue firstMatching(bool test(CssValue value), { CssValue orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ CssValue lastMatching(bool test(CssValue value), {CssValue orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ CssValue singleMatching(bool test(CssValue value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ CssValue elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<CssValue>: |
+ |
+ void add(CssValue value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(CssValue value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<CssValue> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<CssValue>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -25915,9 +27178,25 @@ class _CssValueList extends CssValue implements List<CssValue> { |
return Lists.lastIndexOf(this, element, start); |
} |
- CssValue get first => this[0]; |
+ CssValue get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ CssValue get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ CssValue get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ CssValue min([int compare(CssValue a, CssValue b)]) => _Collections.minInList(this, compare); |
- CssValue get last => this[length - 1]; |
+ CssValue max([int compare(CssValue a, CssValue b)]) => _Collections.maxInList(this, compare); |
CssValue removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26110,27 +27389,13 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> { |
// From Iterable<Entry>: |
- Iterator<Entry> iterator() { |
+ Iterator<Entry> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Entry>(this); |
} |
- // From Collection<Entry>: |
- |
- void add(Entry value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Entry value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Entry> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Entry)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26139,17 +27404,60 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> { |
void forEach(void f(Entry element)) => Collections.forEach(this, f); |
- Collection map(f(Entry element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<Entry> filter(bool f(Entry element)) => |
- Collections.filter(this, <Entry>[], f); |
+ List mappedBy(f(Entry element)) => new MappedList<Entry, dynamic>(this, f); |
+ |
+ Iterable<Entry> where(bool f(Entry element)) => new WhereIterable<Entry>(this, f); |
bool every(bool f(Entry element)) => Collections.every(this, f); |
- bool some(bool f(Entry element)) => Collections.some(this, f); |
+ bool any(bool f(Entry element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Entry> take(int n) => new ListView<Entry>(this, 0, n); |
+ |
+ Iterable<Entry> takeWhile(bool test(Entry value)) { |
+ return new TakeWhileIterable<Entry>(this, test); |
+ } |
+ |
+ List<Entry> skip(int n) => new ListView<Entry>(this, n, null); |
+ |
+ Iterable<Entry> skipWhile(bool test(Entry value)) { |
+ return new SkipWhileIterable<Entry>(this, test); |
+ } |
+ |
+ Entry firstMatching(bool test(Entry value), { Entry orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Entry lastMatching(bool test(Entry value), {Entry orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Entry singleMatching(bool test(Entry value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Entry elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Entry>: |
+ |
+ void add(Entry value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Entry value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Entry> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Entry>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26171,9 +27479,25 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Entry get first => this[0]; |
+ Entry get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Entry get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Entry get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Entry min([int compare(Entry a, Entry b)]) => _Collections.minInList(this, compare); |
- Entry get last => this[length - 1]; |
+ Entry max([int compare(Entry a, Entry b)]) => _Collections.maxInList(this, compare); |
Entry removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26230,27 +27554,13 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync |
// From Iterable<EntrySync>: |
- Iterator<EntrySync> iterator() { |
+ Iterator<EntrySync> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<EntrySync>(this); |
} |
- // From Collection<EntrySync>: |
- |
- void add(EntrySync value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(EntrySync value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<EntrySync> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, EntrySync)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26259,17 +27569,60 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync |
void forEach(void f(EntrySync element)) => Collections.forEach(this, f); |
- Collection map(f(EntrySync element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(EntrySync element)) => new MappedList<EntrySync, dynamic>(this, f); |
- Collection<EntrySync> filter(bool f(EntrySync element)) => |
- Collections.filter(this, <EntrySync>[], f); |
+ Iterable<EntrySync> where(bool f(EntrySync element)) => new WhereIterable<EntrySync>(this, f); |
bool every(bool f(EntrySync element)) => Collections.every(this, f); |
- bool some(bool f(EntrySync element)) => Collections.some(this, f); |
+ bool any(bool f(EntrySync element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<EntrySync> take(int n) => new ListView<EntrySync>(this, 0, n); |
+ |
+ Iterable<EntrySync> takeWhile(bool test(EntrySync value)) { |
+ return new TakeWhileIterable<EntrySync>(this, test); |
+ } |
+ |
+ List<EntrySync> skip(int n) => new ListView<EntrySync>(this, n, null); |
+ |
+ Iterable<EntrySync> skipWhile(bool test(EntrySync value)) { |
+ return new SkipWhileIterable<EntrySync>(this, test); |
+ } |
+ |
+ EntrySync firstMatching(bool test(EntrySync value), { EntrySync orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ EntrySync lastMatching(bool test(EntrySync value), {EntrySync orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ EntrySync singleMatching(bool test(EntrySync value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ EntrySync elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<EntrySync>: |
+ |
+ void add(EntrySync value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(EntrySync value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<EntrySync> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<EntrySync>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26286,14 +27639,30 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync |
int indexOf(EntrySync element, [int start = 0]) => |
Lists.indexOf(this, element, start, this.length); |
- int lastIndexOf(EntrySync element, [int start]) { |
- if (start == null) start = length - 1; |
- return Lists.lastIndexOf(this, element, start); |
+ int lastIndexOf(EntrySync element, [int start]) { |
+ if (start == null) start = length - 1; |
+ return Lists.lastIndexOf(this, element, start); |
+ } |
+ |
+ EntrySync get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ EntrySync get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ EntrySync get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
} |
- EntrySync get first => this[0]; |
+ EntrySync min([int compare(EntrySync a, EntrySync b)]) => _Collections.minInList(this, compare); |
- EntrySync get last => this[length - 1]; |
+ EntrySync max([int compare(EntrySync a, EntrySync b)]) => _Collections.maxInList(this, compare); |
EntrySync removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26350,27 +27719,13 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> { |
// From Iterable<Gamepad>: |
- Iterator<Gamepad> iterator() { |
+ Iterator<Gamepad> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<Gamepad>(this); |
} |
- // From Collection<Gamepad>: |
- |
- void add(Gamepad value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(Gamepad value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<Gamepad> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Gamepad)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26379,17 +27734,60 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> { |
void forEach(void f(Gamepad element)) => Collections.forEach(this, f); |
- Collection map(f(Gamepad element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<Gamepad> filter(bool f(Gamepad element)) => |
- Collections.filter(this, <Gamepad>[], f); |
+ List mappedBy(f(Gamepad element)) => new MappedList<Gamepad, dynamic>(this, f); |
+ |
+ Iterable<Gamepad> where(bool f(Gamepad element)) => new WhereIterable<Gamepad>(this, f); |
bool every(bool f(Gamepad element)) => Collections.every(this, f); |
- bool some(bool f(Gamepad element)) => Collections.some(this, f); |
+ bool any(bool f(Gamepad element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<Gamepad> take(int n) => new ListView<Gamepad>(this, 0, n); |
+ |
+ Iterable<Gamepad> takeWhile(bool test(Gamepad value)) { |
+ return new TakeWhileIterable<Gamepad>(this, test); |
+ } |
+ |
+ List<Gamepad> skip(int n) => new ListView<Gamepad>(this, n, null); |
+ |
+ Iterable<Gamepad> skipWhile(bool test(Gamepad value)) { |
+ return new SkipWhileIterable<Gamepad>(this, test); |
+ } |
+ |
+ Gamepad firstMatching(bool test(Gamepad value), { Gamepad orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ Gamepad lastMatching(bool test(Gamepad value), {Gamepad orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ Gamepad singleMatching(bool test(Gamepad value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ Gamepad elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<Gamepad>: |
+ |
+ void add(Gamepad value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(Gamepad value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<Gamepad> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<Gamepad>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26411,9 +27809,25 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> { |
return Lists.lastIndexOf(this, element, start); |
} |
- Gamepad get first => this[0]; |
+ Gamepad get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Gamepad get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ Gamepad get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ Gamepad min([int compare(Gamepad a, Gamepad b)]) => _Collections.minInList(this, compare); |
- Gamepad get last => this[length - 1]; |
+ Gamepad max([int compare(Gamepad a, Gamepad b)]) => _Collections.maxInList(this, compare); |
Gamepad removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26470,27 +27884,13 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr |
// From Iterable<MediaStream>: |
- Iterator<MediaStream> iterator() { |
+ Iterator<MediaStream> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<MediaStream>(this); |
} |
- // From Collection<MediaStream>: |
- |
- void add(MediaStream value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(MediaStream value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<MediaStream> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, MediaStream)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26499,17 +27899,60 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr |
void forEach(void f(MediaStream element)) => Collections.forEach(this, f); |
- Collection map(f(MediaStream element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(MediaStream element)) => new MappedList<MediaStream, dynamic>(this, f); |
- Collection<MediaStream> filter(bool f(MediaStream element)) => |
- Collections.filter(this, <MediaStream>[], f); |
+ Iterable<MediaStream> where(bool f(MediaStream element)) => new WhereIterable<MediaStream>(this, f); |
bool every(bool f(MediaStream element)) => Collections.every(this, f); |
- bool some(bool f(MediaStream element)) => Collections.some(this, f); |
+ bool any(bool f(MediaStream element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<MediaStream> take(int n) => new ListView<MediaStream>(this, 0, n); |
+ |
+ Iterable<MediaStream> takeWhile(bool test(MediaStream value)) { |
+ return new TakeWhileIterable<MediaStream>(this, test); |
+ } |
+ |
+ List<MediaStream> skip(int n) => new ListView<MediaStream>(this, n, null); |
+ |
+ Iterable<MediaStream> skipWhile(bool test(MediaStream value)) { |
+ return new SkipWhileIterable<MediaStream>(this, test); |
+ } |
+ |
+ MediaStream firstMatching(bool test(MediaStream value), { MediaStream orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ MediaStream lastMatching(bool test(MediaStream value), {MediaStream orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ MediaStream singleMatching(bool test(MediaStream value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ MediaStream elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<MediaStream>: |
+ |
+ void add(MediaStream value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(MediaStream value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<MediaStream> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<MediaStream>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26531,9 +27974,25 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr |
return Lists.lastIndexOf(this, element, start); |
} |
- MediaStream get first => this[0]; |
+ MediaStream get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ MediaStream get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ MediaStream get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ MediaStream min([int compare(MediaStream a, MediaStream b)]) => _Collections.minInList(this, compare); |
- MediaStream get last => this[length - 1]; |
+ MediaStream max([int compare(MediaStream a, MediaStream b)]) => _Collections.maxInList(this, compare); |
MediaStream removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26590,27 +28049,13 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp |
// From Iterable<SpeechInputResult>: |
- Iterator<SpeechInputResult> iterator() { |
+ Iterator<SpeechInputResult> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<SpeechInputResult>(this); |
} |
- // From Collection<SpeechInputResult>: |
- |
- void add(SpeechInputResult value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(SpeechInputResult value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<SpeechInputResult> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechInputResult)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26619,17 +28064,60 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp |
void forEach(void f(SpeechInputResult element)) => Collections.forEach(this, f); |
- Collection map(f(SpeechInputResult element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<SpeechInputResult> filter(bool f(SpeechInputResult element)) => |
- Collections.filter(this, <SpeechInputResult>[], f); |
+ List mappedBy(f(SpeechInputResult element)) => new MappedList<SpeechInputResult, dynamic>(this, f); |
+ |
+ Iterable<SpeechInputResult> where(bool f(SpeechInputResult element)) => new WhereIterable<SpeechInputResult>(this, f); |
bool every(bool f(SpeechInputResult element)) => Collections.every(this, f); |
- bool some(bool f(SpeechInputResult element)) => Collections.some(this, f); |
+ bool any(bool f(SpeechInputResult element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<SpeechInputResult> take(int n) => new ListView<SpeechInputResult>(this, 0, n); |
+ |
+ Iterable<SpeechInputResult> takeWhile(bool test(SpeechInputResult value)) { |
+ return new TakeWhileIterable<SpeechInputResult>(this, test); |
+ } |
+ |
+ List<SpeechInputResult> skip(int n) => new ListView<SpeechInputResult>(this, n, null); |
+ |
+ Iterable<SpeechInputResult> skipWhile(bool test(SpeechInputResult value)) { |
+ return new SkipWhileIterable<SpeechInputResult>(this, test); |
+ } |
+ |
+ SpeechInputResult firstMatching(bool test(SpeechInputResult value), { SpeechInputResult orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ SpeechInputResult lastMatching(bool test(SpeechInputResult value), {SpeechInputResult orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ SpeechInputResult singleMatching(bool test(SpeechInputResult value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ SpeechInputResult elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<SpeechInputResult>: |
+ |
+ void add(SpeechInputResult value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(SpeechInputResult value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<SpeechInputResult> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<SpeechInputResult>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26651,9 +28139,25 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp |
return Lists.lastIndexOf(this, element, start); |
} |
- SpeechInputResult get first => this[0]; |
+ SpeechInputResult get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SpeechInputResult get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SpeechInputResult get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ SpeechInputResult min([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.minInList(this, compare); |
- SpeechInputResult get last => this[length - 1]; |
+ SpeechInputResult max([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.maxInList(this, compare); |
SpeechInputResult removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26710,27 +28214,13 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L |
// From Iterable<SpeechRecognitionResult>: |
- Iterator<SpeechRecognitionResult> iterator() { |
+ Iterator<SpeechRecognitionResult> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<SpeechRecognitionResult>(this); |
} |
- // From Collection<SpeechRecognitionResult>: |
- |
- void add(SpeechRecognitionResult value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(SpeechRecognitionResult value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<SpeechRecognitionResult> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitionResult)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26739,17 +28229,60 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L |
void forEach(void f(SpeechRecognitionResult element)) => Collections.forEach(this, f); |
- Collection map(f(SpeechRecognitionResult element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
+ |
+ List mappedBy(f(SpeechRecognitionResult element)) => new MappedList<SpeechRecognitionResult, dynamic>(this, f); |
- Collection<SpeechRecognitionResult> filter(bool f(SpeechRecognitionResult element)) => |
- Collections.filter(this, <SpeechRecognitionResult>[], f); |
+ Iterable<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element)) => new WhereIterable<SpeechRecognitionResult>(this, f); |
bool every(bool f(SpeechRecognitionResult element)) => Collections.every(this, f); |
- bool some(bool f(SpeechRecognitionResult element)) => Collections.some(this, f); |
+ bool any(bool f(SpeechRecognitionResult element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<SpeechRecognitionResult> take(int n) => new ListView<SpeechRecognitionResult>(this, 0, n); |
+ |
+ Iterable<SpeechRecognitionResult> takeWhile(bool test(SpeechRecognitionResult value)) { |
+ return new TakeWhileIterable<SpeechRecognitionResult>(this, test); |
+ } |
+ |
+ List<SpeechRecognitionResult> skip(int n) => new ListView<SpeechRecognitionResult>(this, n, null); |
+ |
+ Iterable<SpeechRecognitionResult> skipWhile(bool test(SpeechRecognitionResult value)) { |
+ return new SkipWhileIterable<SpeechRecognitionResult>(this, test); |
+ } |
+ |
+ SpeechRecognitionResult firstMatching(bool test(SpeechRecognitionResult value), { SpeechRecognitionResult orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ SpeechRecognitionResult lastMatching(bool test(SpeechRecognitionResult value), {SpeechRecognitionResult orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ SpeechRecognitionResult singleMatching(bool test(SpeechRecognitionResult value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ SpeechRecognitionResult elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<SpeechRecognitionResult>: |
+ |
+ void add(SpeechRecognitionResult value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(SpeechRecognitionResult value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<SpeechRecognitionResult> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<SpeechRecognitionResult>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26771,9 +28304,25 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L |
return Lists.lastIndexOf(this, element, start); |
} |
- SpeechRecognitionResult get first => this[0]; |
+ SpeechRecognitionResult get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SpeechRecognitionResult get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ SpeechRecognitionResult get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ SpeechRecognitionResult min([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) => _Collections.minInList(this, compare); |
- SpeechRecognitionResult get last => this[length - 1]; |
+ SpeechRecognitionResult max([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) => _Collections.maxInList(this, compare); |
SpeechRecognitionResult removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -26830,27 +28379,13 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee |
// From Iterable<StyleSheet>: |
- Iterator<StyleSheet> iterator() { |
+ Iterator<StyleSheet> get iterator { |
// Note: NodeLists are not fixed size. And most probably length shouldn't |
// be cached in both iterator _and_ forEach method. For now caching it |
// for consistency. |
return new FixedSizeListIterator<StyleSheet>(this); |
} |
- // From Collection<StyleSheet>: |
- |
- void add(StyleSheet value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addLast(StyleSheet value) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
- void addAll(Collection<StyleSheet> collection) { |
- throw new UnsupportedError("Cannot add to immutable List."); |
- } |
- |
dynamic reduce(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) { |
return Collections.reduce(this, initialValue, combine); |
} |
@@ -26859,17 +28394,60 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee |
void forEach(void f(StyleSheet element)) => Collections.forEach(this, f); |
- Collection map(f(StyleSheet element)) => Collections.map(this, [], f); |
+ String join([String separator]) => Collections.joinList(this, separator); |
- Collection<StyleSheet> filter(bool f(StyleSheet element)) => |
- Collections.filter(this, <StyleSheet>[], f); |
+ List mappedBy(f(StyleSheet element)) => new MappedList<StyleSheet, dynamic>(this, f); |
+ |
+ Iterable<StyleSheet> where(bool f(StyleSheet element)) => new WhereIterable<StyleSheet>(this, f); |
bool every(bool f(StyleSheet element)) => Collections.every(this, f); |
- bool some(bool f(StyleSheet element)) => Collections.some(this, f); |
+ bool any(bool f(StyleSheet element)) => Collections.any(this, f); |
bool get isEmpty => this.length == 0; |
+ List<StyleSheet> take(int n) => new ListView<StyleSheet>(this, 0, n); |
+ |
+ Iterable<StyleSheet> takeWhile(bool test(StyleSheet value)) { |
+ return new TakeWhileIterable<StyleSheet>(this, test); |
+ } |
+ |
+ List<StyleSheet> skip(int n) => new ListView<StyleSheet>(this, n, null); |
+ |
+ Iterable<StyleSheet> skipWhile(bool test(StyleSheet value)) { |
+ return new SkipWhileIterable<StyleSheet>(this, test); |
+ } |
+ |
+ StyleSheet firstMatching(bool test(StyleSheet value), { StyleSheet orElse() }) { |
+ return Collections.firstMatching(this, test, orElse); |
+ } |
+ |
+ StyleSheet lastMatching(bool test(StyleSheet value), {StyleSheet orElse()}) { |
+ return Collections.lastMatchingInList(this, test, orElse); |
+ } |
+ |
+ StyleSheet singleMatching(bool test(StyleSheet value)) { |
+ return Collections.singleMatching(this, test); |
+ } |
+ |
+ StyleSheet elementAt(int index) { |
+ return this[index]; |
+ } |
+ |
+ // From Collection<StyleSheet>: |
+ |
+ void add(StyleSheet value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addLast(StyleSheet value) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
+ void addAll(Iterable<StyleSheet> iterable) { |
+ throw new UnsupportedError("Cannot add to immutable List."); |
+ } |
+ |
// From List<StyleSheet>: |
void set length(int value) { |
throw new UnsupportedError("Cannot resize immutable List."); |
@@ -26891,9 +28469,25 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee |
return Lists.lastIndexOf(this, element, start); |
} |
- StyleSheet get first => this[0]; |
+ StyleSheet get first { |
+ if (this.length > 0) return this[0]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ StyleSheet get last { |
+ if (this.length > 0) return this[this.length - 1]; |
+ throw new StateError("No elements"); |
+ } |
+ |
+ StyleSheet get single { |
+ if (length == 1) return this[0]; |
+ if (length == 0) throw new StateError("No elements"); |
+ throw new StateError("More than one element"); |
+ } |
+ |
+ StyleSheet min([int compare(StyleSheet a, StyleSheet b)]) => _Collections.minInList(this, compare); |
- StyleSheet get last => this[length - 1]; |
+ StyleSheet max([int compare(StyleSheet a, StyleSheet b)]) => _Collections.maxInList(this, compare); |
StyleSheet removeAt(int pos) { |
throw new UnsupportedError("Cannot removeAt on immutable List."); |
@@ -27087,7 +28681,7 @@ class _DataAttributeMap implements Map<String, String> { |
// interface Map |
// TODO: Use lazy iterator when it is available on Map. |
- bool containsValue(String value) => values.some((v) => v == value); |
+ bool containsValue(String value) => values.any((v) => v == value); |
bool containsKey(String key) => $dom_attributes.containsKey(_attr(key)); |
@@ -27310,7 +28904,7 @@ abstract class CssClassSet implements Set<String> { |
bool get frozen => false; |
// interface Iterable - BEGIN |
- Iterator<String> iterator() => readClasses().iterator(); |
+ Iterator<String> get iterator => readClasses().iterator; |
// interface Iterable - END |
// interface Collection - BEGIN |
@@ -27318,13 +28912,15 @@ abstract class CssClassSet implements Set<String> { |
readClasses().forEach(f); |
} |
- Collection map(f(String element)) => readClasses().map(f); |
+ String join([String separator]) => readClasses().join(separator); |
- Collection<String> filter(bool f(String element)) => readClasses().filter(f); |
+ Iterable mappedBy(f(String element)) => readClasses().mappedBy(f); |
+ |
+ Iterable<String> where(bool f(String element)) => readClasses().where(f); |
bool every(bool f(String element)) => readClasses().every(f); |
- bool some(bool f(String element)) => readClasses().some(f); |
+ bool any(bool f(String element)) => readClasses().any(f); |
bool get isEmpty => readClasses().isEmpty; |
@@ -27352,13 +28948,13 @@ abstract class CssClassSet implements Set<String> { |
return result; |
} |
- void addAll(Collection<String> collection) { |
+ void addAll(Iterable<String> iterable) { |
// TODO - see comment above about validation |
- _modify((s) => s.addAll(collection)); |
+ _modify((s) => s.addAll(iterable)); |
} |
- void removeAll(Collection<String> collection) { |
- _modify((s) => s.removeAll(collection)); |
+ void removeAll(Iterable<String> iterable) { |
+ _modify((s) => s.removeAll(iterable)); |
} |
bool isSubsetOf(Collection<String> collection) => |
@@ -27561,7 +29157,7 @@ class KeyboardEventController { |
/** Determine if caps lock is one of the currently depressed keys. */ |
bool get _capsLockOn => |
- _keyDownList.some((var element) => element.keyCode == KeyCode.CAPS_LOCK); |
+ _keyDownList.any((var element) => element.keyCode == KeyCode.CAPS_LOCK); |
/** |
* Given the previously recorded keydown key codes, see if we can determine |
@@ -27790,7 +29386,7 @@ class KeyboardEventController { |
// keyCode/which for non printable keys. |
e._shadowKeyCode = _keyIdentifier[e._shadowKeyIdentifier]; |
} |
- e._shadowAltKey = _keyDownList.some((var element) => element.altKey); |
+ e._shadowAltKey = _keyDownList.any((var element) => element.altKey); |
_dispatch(e); |
} |
@@ -27804,7 +29400,8 @@ class KeyboardEventController { |
} |
} |
if (toRemove != null) { |
- _keyDownList = _keyDownList.filter((element) => element != toRemove); |
+ _keyDownList = |
+ _keyDownList.where((element) => element != toRemove).toList(); |
} else if (_keyDownList.length > 0) { |
// This happens when we've reached some international keyboard case we |
// haven't accounted for or we haven't correctly eliminated all browser |
@@ -29076,7 +30673,7 @@ class _RemoteSendPortSync implements SendPortSync { |
var source = '$target-result'; |
var result = null; |
var listener = (Event e) { |
- result = JSON.parse(_getPortSyncEventData(e)); |
+ result = json.parse(_getPortSyncEventData(e)); |
}; |
window.on[source].add(listener); |
_dispatchEvent(target, [source, message]); |
@@ -29148,7 +30745,7 @@ class ReceivePortSync { |
_callback = callback; |
if (_listener == null) { |
_listener = (Event e) { |
- var data = JSON.parse(_getPortSyncEventData(e)); |
+ var data = json.parse(_getPortSyncEventData(e)); |
var replyTo = data[0]; |
var message = _deserialize(data[1]); |
var result = _callback(message); |
@@ -29179,7 +30776,7 @@ class ReceivePortSync { |
get _isolateId => ReceivePortSync._isolateId; |
void _dispatchEvent(String receiver, var message) { |
- var event = new CustomEvent(receiver, false, false, JSON.stringify(message)); |
+ var event = new CustomEvent(receiver, false, false, json.stringify(message)); |
window.$dom_dispatchEvent(event); |
} |
@@ -29474,15 +31071,15 @@ abstract class _Serializer extends _MessageTraverser { |
int id = _nextFreeRefId++; |
_visited[map] = id; |
- var keys = _serializeList(map.keys); |
- var values = _serializeList(map.values); |
+ var keys = _serializeList(map.keys.toList()); |
+ var values = _serializeList(map.values.toList()); |
// TODO(floitsch): we are losing the generic type. |
return ['map', id, keys, values]; |
} |
_serializeList(List list) { |
int len = list.length; |
- var result = new List(len); |
+ var result = new List.fixedLength(len); |
for (int i = 0; i < len; i++) { |
result[i] = _dispatch(list[i]); |
} |
@@ -29588,33 +31185,55 @@ class Testing { |
// Iterator for arrays with fixed size. |
-class FixedSizeListIterator<T> extends _VariableSizeListIterator<T> { |
+class FixedSizeListIterator<T> implements Iterator<T> { |
+ final List<T> _array; |
+ final int _length; // Cache array length for faster access. |
+ int _position; |
+ T _current; |
+ |
FixedSizeListIterator(List<T> array) |
- : super(array), |
+ : _array = array, |
+ _position = -1, |
_length = array.length; |
- bool get hasNext => _length > _pos; |
+ bool moveNext() { |
+ int nextPosition = _position + 1; |
+ if (nextPosition < _length) { |
+ _current = _array[nextPosition]; |
+ _position = nextPosition; |
+ return true; |
+ } |
+ _current = null; |
+ _position = _length; |
+ return false; |
+ } |
- final int _length; // Cache array length for faster access. |
+ T get current => _current; |
} |
// Iterator for arrays with variable size. |
class _VariableSizeListIterator<T> implements Iterator<T> { |
+ final List<T> _array; |
+ int _position; |
+ T _current; |
+ |
_VariableSizeListIterator(List<T> array) |
: _array = array, |
- _pos = 0; |
+ _position = -1; |
- bool get hasNext => _array.length > _pos; |
- |
- T next() { |
- if (!hasNext) { |
- throw new StateError("No more elements"); |
+ bool moveNext() { |
+ int nextPosition = _position + 1; |
+ if (nextPosition < _array.length) { |
+ _current = _array[nextPosition]; |
+ _position = nextPosition; |
+ return true; |
} |
- return _array[_pos++]; |
+ _current = null; |
+ _position = _array.length; |
+ return false; |
} |
- final List<T> _array; |
- int _pos; |
+ T get current => _current; |
} |
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
@@ -29655,7 +31274,7 @@ class _Utils { |
static List convertToList(List list) { |
// FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it. |
final length = list.length; |
- List result = new List(length); |
+ List result = new List.fixedLength(length); |
result.setRange(0, length, list); |
return result; |
} |