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 part of dart.collection; | 5 part of dart.collection; |
6 | 6 |
7 /** | 7 /** |
8 * A [LinkedHashSet] is a hash-table based [Set] implementation. | 8 * A [LinkedHashSet] is a hash-table based [Set] implementation. |
9 * | 9 * |
10 * The `LinkedHashSet` also keep track of the order that elements were inserted | 10 * The `LinkedHashSet` also keep track of the order that elements were inserted |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * | 85 * |
86 * new LinkedHashSet<E>(equals: identical, | 86 * new LinkedHashSet<E>(equals: identical, |
87 * hashCode: identityHashCode) | 87 * hashCode: identityHashCode) |
88 */ | 88 */ |
89 external factory LinkedHashSet.identity(); | 89 external factory LinkedHashSet.identity(); |
90 | 90 |
91 /** | 91 /** |
92 * Create a linked hash set containing all [elements]. | 92 * Create a linked hash set containing all [elements]. |
93 * | 93 * |
94 * Creates a linked hash set as by `new LinkedHashSet<E>()` and adds each | 94 * Creates a linked hash set as by `new LinkedHashSet<E>()` and adds each |
95 * element of`elements` to this set in the order they are iterated. | 95 * element of `elements` to this set in the order they are iterated. |
96 * | 96 * |
97 * All the [elements] should be assignable to [E]. | 97 * All the [elements] should be assignable to [E]. |
98 * The `elements` iterable itself may have any element type, | 98 * The `elements` iterable itself may have any element type, |
99 * so this constructor can be used to down-cast a `Set`, for example as: | 99 * so this constructor can be used to down-cast a `Set`, for example as: |
100 * | 100 * |
101 * Set<SuperType> superSet = ...; | 101 * Set<SuperType> superSet = ...; |
102 * Iterable<SuperType> tmp = superSet.where((e) => e is SubType); | 102 * Iterable<SuperType> tmp = superSet.where((e) => e is SubType); |
103 * Set<SubType> subSet = new LinkedHashSet<SubType>.from(tmp); | 103 * Set<SubType> subSet = new LinkedHashSet<SubType>.from(tmp); |
104 */ | 104 */ |
105 factory LinkedHashSet.from(Iterable elements) { | 105 factory LinkedHashSet.from(Iterable elements) { |
(...skipping 10 matching lines...) Expand all Loading... |
116 * | 116 * |
117 * The elements are iterated in insertion order. | 117 * The elements are iterated in insertion order. |
118 */ | 118 */ |
119 void forEach(void action(E element)); | 119 void forEach(void action(E element)); |
120 | 120 |
121 /** | 121 /** |
122 * Provides an iterator that iterates over the elements in insertion order. | 122 * Provides an iterator that iterates over the elements in insertion order. |
123 */ | 123 */ |
124 Iterator<E> get iterator; | 124 Iterator<E> get iterator; |
125 } | 125 } |
OLD | NEW |