OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:collection"; | 5 import "dart:collection"; |
6 import "dart:math" as math; | 6 import "dart:math" as math; |
7 | 7 |
8 import "typed_wrappers.dart"; | 8 import "typed_wrappers.dart"; |
9 import "unmodifiable_wrappers.dart"; | 9 import "unmodifiable_wrappers.dart"; |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 void addAll(Iterable<E> elements) { | 246 void addAll(Iterable<E> elements) { |
247 _setBase.addAll(elements); | 247 _setBase.addAll(elements); |
248 } | 248 } |
249 | 249 |
250 void clear() { | 250 void clear() { |
251 _setBase.clear(); | 251 _setBase.clear(); |
252 } | 252 } |
253 | 253 |
254 bool containsAll(Iterable<Object> other) => _setBase.containsAll(other); | 254 bool containsAll(Iterable<Object> other) => _setBase.containsAll(other); |
255 | 255 |
256 Set<E> difference(Set<E> other) => _setBase.difference(other); | 256 Set<E> difference(Set<Object> other) => _setBase.difference(other); |
257 | 257 |
258 Set<E> intersection(Set<Object> other) => _setBase.intersection(other); | 258 Set<E> intersection(Set<Object> other) => _setBase.intersection(other); |
259 | 259 |
260 E lookup(Object element) => _setBase.lookup(element); | 260 E lookup(Object element) => _setBase.lookup(element); |
261 | 261 |
262 bool remove(Object value) => _setBase.remove(value); | 262 bool remove(Object value) => _setBase.remove(value); |
263 | 263 |
264 void removeAll(Iterable<Object> elements) { | 264 void removeAll(Iterable<Object> elements) { |
265 _setBase.removeAll(elements); | 265 _setBase.removeAll(elements); |
266 } | 266 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 bool containsAll(Iterable<Object> other) => other.every(contains); | 430 bool containsAll(Iterable<Object> other) => other.every(contains); |
431 | 431 |
432 /// Returns a new set with the the elements of [this] that are not in [other]. | 432 /// Returns a new set with the the elements of [this] that are not in [other]. |
433 /// | 433 /// |
434 /// That is, the returned set contains all the elements of this [Set] that are | 434 /// That is, the returned set contains all the elements of this [Set] that are |
435 /// not elements of [other] according to `other.contains`. | 435 /// not elements of [other] according to `other.contains`. |
436 /// | 436 /// |
437 /// Note that the returned set will use the default equality operation, which | 437 /// Note that the returned set will use the default equality operation, which |
438 /// may be different than the equality operation [this] uses. | 438 /// may be different than the equality operation [this] uses. |
439 Set<E> difference(Set<E> other) => | 439 Set<E> difference(Set<Object> other) => |
440 where((element) => !other.contains(element)).toSet(); | 440 where((element) => !other.contains(element)).toSet(); |
441 | 441 |
442 /// Returns a new set which is the intersection between [this] and [other]. | 442 /// Returns a new set which is the intersection between [this] and [other]. |
443 /// | 443 /// |
444 /// That is, the returned set contains all the elements of this [Set] that are | 444 /// That is, the returned set contains all the elements of this [Set] that are |
445 /// also elements of [other] according to `other.contains`. | 445 /// also elements of [other] according to `other.contains`. |
446 /// | 446 /// |
447 /// Note that the returned set will use the default equality operation, which | 447 /// Note that the returned set will use the default equality operation, which |
448 /// may be different than the equality operation [this] uses. | 448 /// may be different than the equality operation [this] uses. |
449 Set<E> intersection(Set<Object> other) => where(other.contains).toSet(); | 449 Set<E> intersection(Set<Object> other) => where(other.contains).toSet(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 530 |
531 bool containsAll(Iterable<Object> other) => other.every(contains); | 531 bool containsAll(Iterable<Object> other) => other.every(contains); |
532 | 532 |
533 /// Returns a new set with the the elements of [this] that are not in [other]. | 533 /// Returns a new set with the the elements of [this] that are not in [other]. |
534 /// | 534 /// |
535 /// That is, the returned set contains all the elements of this [Set] that are | 535 /// That is, the returned set contains all the elements of this [Set] that are |
536 /// not elements of [other] according to `other.contains`. | 536 /// not elements of [other] according to `other.contains`. |
537 /// | 537 /// |
538 /// Note that the returned set will use the default equality operation, which | 538 /// Note that the returned set will use the default equality operation, which |
539 /// may be different than the equality operation [this] uses. | 539 /// may be different than the equality operation [this] uses. |
540 Set<V> difference(Set<V> other) => | 540 Set<V> difference(Set<Object> other) => |
541 where((element) => !other.contains(element)).toSet(); | 541 where((element) => !other.contains(element)).toSet(); |
542 | 542 |
543 /// Returns a new set which is the intersection between [this] and [other]. | 543 /// Returns a new set which is the intersection between [this] and [other]. |
544 /// | 544 /// |
545 /// That is, the returned set contains all the elements of this [Set] that are | 545 /// That is, the returned set contains all the elements of this [Set] that are |
546 /// also elements of [other] according to `other.contains`. | 546 /// also elements of [other] according to `other.contains`. |
547 /// | 547 /// |
548 /// Note that the returned set will use the default equality operation, which | 548 /// Note that the returned set will use the default equality operation, which |
549 /// may be different than the equality operation [this] uses. | 549 /// may be different than the equality operation [this] uses. |
550 Set<V> intersection(Set<Object> other) => where(other.contains).toSet(); | 550 Set<V> intersection(Set<Object> other) => where(other.contains).toSet(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 597 |
598 /// Returns a new set which contains all the elements of [this] and [other]. | 598 /// Returns a new set which contains all the elements of [this] and [other]. |
599 /// | 599 /// |
600 /// That is, the returned set contains all the elements of this [Set] and all | 600 /// That is, the returned set contains all the elements of this [Set] and all |
601 /// the elements of [other]. | 601 /// the elements of [other]. |
602 /// | 602 /// |
603 /// Note that the returned set will use the default equality operation, which | 603 /// Note that the returned set will use the default equality operation, which |
604 /// may be different than the equality operation [this] uses. | 604 /// may be different than the equality operation [this] uses. |
605 Set<V> union(Set<V> other) => toSet()..addAll(other); | 605 Set<V> union(Set<V> other) => toSet()..addAll(other); |
606 } | 606 } |
OLD | NEW |