| Index: sdk/lib/_internal/lib/collection_patch.dart
|
| diff --git a/sdk/lib/_internal/lib/collection_patch.dart b/sdk/lib/_internal/lib/collection_patch.dart
|
| index 7d6313c42dfd6466c8d4cac242a995d3be1f577c..7c32ebf532a38a65bc8b967092000ac0b1c934cf 100644
|
| --- a/sdk/lib/_internal/lib/collection_patch.dart
|
| +++ b/sdk/lib/_internal/lib/collection_patch.dart
|
| @@ -987,6 +987,18 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
|
| }
|
| }
|
|
|
| + E lookup(Object object) {
|
| + if (_isStringElement(object) || _isNumericElement(object)) {
|
| + return this.contains(object) ? object : null;
|
| + }
|
| + var rest = _rest;
|
| + if (rest == null) return null;
|
| + var bucket = _getBucket(rest, object);
|
| + var index = _findBucketIndex(bucket, object);
|
| + if (index < 0) return null;
|
| + return bucket[index];
|
| + }
|
| +
|
| // Collection.
|
| void add(E element) {
|
| if (_isStringElement(element)) {
|
| @@ -1251,6 +1263,11 @@ class _CustomHashSet<E> extends _HashSet<E> {
|
| return super.contains(object);
|
| }
|
|
|
| + E lookup(Object object) {
|
| + if (!_validKey(object)) return null;
|
| + return super.lookup(object);
|
| + }
|
| +
|
| bool remove(Object object) {
|
| if (!_validKey(object)) return false;
|
| return super.remove(object);
|
| @@ -1401,6 +1418,19 @@ class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
| }
|
| }
|
|
|
| + E lookup(Object object) {
|
| + if (_isStringElement(object) || _isNumericElement(object)) {
|
| + return this.contains(object) ? object : null;
|
| + } else {
|
| + var rest = _rest;
|
| + if (rest == null) return null;
|
| + var bucket = _getBucket(rest, object);
|
| + var index = _findBucketIndex(bucket, object);
|
| + if (index < 0) return null;
|
| + return bucket[index]._element;
|
| + }
|
| + }
|
| +
|
| void forEach(void action(E element)) {
|
| LinkedHashSetCell cell = _first;
|
| int modifications = _modifications;
|
| @@ -1690,6 +1720,11 @@ class _LinkedCustomHashSet<E> extends _LinkedHashSet<E> {
|
| return super.contains(object);
|
| }
|
|
|
| + E lookup(Object object) {
|
| + if (!_validKey(object)) return null;
|
| + return super.lookup(object);
|
| + }
|
| +
|
| bool remove(Object object) {
|
| if (!_validKey(object)) return false;
|
| return super.remove(object);
|
|
|