| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * This class is the public interface of a set. A set is a collection | |
| 7 * without duplicates. | |
| 8 */ | |
| 9 interface Set<E> extends Collection<E> | |
| 10 default HashSetImplementation<E extends Hashable> { | |
| 11 Set(); | |
| 12 | |
| 13 /** | |
| 14 * Creates a [Set] that contains all elements of [other]. | |
| 15 */ | |
| 16 Set.from(Iterable<E> other); | |
| 17 | |
| 18 /** | |
| 19 * Returns true if [value] is in the set. | |
| 20 */ | |
| 21 bool contains(E value); | |
| 22 | |
| 23 /** | |
| 24 * Adds [value] into the set. The method has no effect if | |
| 25 * [value] was already in the set. | |
| 26 */ | |
| 27 void add(E value); | |
| 28 | |
| 29 /** | |
| 30 * Removes [value] from the set. Returns true if [value] was | |
| 31 * in the set. Returns false otherwise. The method has no effect | |
| 32 * if [value] value was not in the set. | |
| 33 */ | |
| 34 bool remove(E value); | |
| 35 | |
| 36 /** | |
| 37 * Adds all the elements of the given collection to the set. | |
| 38 */ | |
| 39 void addAll(Collection<E> collection); | |
| 40 | |
| 41 /** | |
| 42 * Removes all the elements of the given collection from the set. | |
| 43 */ | |
| 44 void removeAll(Collection<E> collection); | |
| 45 | |
| 46 /** | |
| 47 * Returns true if [collection] contains all the elements of this | |
| 48 * collection. | |
| 49 */ | |
| 50 bool isSubsetOf(Collection<E> collection); | |
| 51 | |
| 52 /** | |
| 53 * Returns true if this collection contains all the elements of | |
| 54 * [collection]. | |
| 55 */ | |
| 56 bool containsAll(Collection<E> collection); | |
| 57 | |
| 58 /** | |
| 59 * Returns a new set which is the intersection between this set and | |
| 60 * the given collection. | |
| 61 */ | |
| 62 Set<E> intersection(Collection<E> other); | |
| 63 | |
| 64 /** | |
| 65 * Removes all elements in the set. | |
| 66 */ | |
| 67 void clear(); | |
| 68 | |
| 69 } | |
| 70 | |
| 71 interface HashSet<E extends Hashable> extends Set<E> | |
| 72 default HashSetImplementation<E extends Hashable> { | |
| 73 HashSet(); | |
| 74 | |
| 75 /** | |
| 76 * Creates a [Set] that contains all elements of [other]. | |
| 77 */ | |
| 78 HashSet.from(Iterable<E> other); | |
| 79 } | |
| OLD | NEW |