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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 * If neither `equals`, `hashCode`, nor `isValidKey` is provided, | 67 * If neither `equals`, `hashCode`, nor `isValidKey` is provided, |
68 * the default `isValidKey` instead accepts all values. | 68 * the default `isValidKey` instead accepts all values. |
69 * The default equality and hashcode operations are assumed to work on all | 69 * The default equality and hashcode operations are assumed to work on all |
70 * objects. | 70 * objects. |
71 * | 71 * |
72 * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode] | 72 * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode] |
73 * and `isValidKey` is omitted, the resulting set is identity based, | 73 * and `isValidKey` is omitted, the resulting set is identity based, |
74 * and the `isValidKey` defaults to accepting all keys. | 74 * and the `isValidKey` defaults to accepting all keys. |
75 * Such a map can be created directly using [LinkedHashSet.identity]. | 75 * Such a map can be created directly using [LinkedHashSet.identity]. |
76 */ | 76 */ |
77 external factory LinkedHashSet({bool equals(E e1, E e2), | 77 external factory LinkedHashSet( |
78 int hashCode(E e), | 78 {bool equals(E e1, E e2), |
79 bool isValidKey(potentialKey)}); | 79 int hashCode(E e), |
| 80 bool isValidKey(potentialKey)}); |
80 | 81 |
81 /** | 82 /** |
82 * Creates an insertion-ordered identity-based set. | 83 * Creates an insertion-ordered identity-based set. |
83 * | 84 * |
84 * Effectively a shorthand for: | 85 * Effectively a shorthand for: |
85 * | 86 * |
86 * new LinkedHashSet<E>(equals: identical, | 87 * new LinkedHashSet<E>(equals: identical, |
87 * hashCode: identityHashCode) | 88 * hashCode: identityHashCode) |
88 */ | 89 */ |
89 external factory LinkedHashSet.identity(); | 90 external factory LinkedHashSet.identity(); |
(...skipping 26 matching lines...) Expand all Loading... |
116 * | 117 * |
117 * The elements are iterated in insertion order. | 118 * The elements are iterated in insertion order. |
118 */ | 119 */ |
119 void forEach(void action(E element)); | 120 void forEach(void action(E element)); |
120 | 121 |
121 /** | 122 /** |
122 * Provides an iterator that iterates over the elements in insertion order. | 123 * Provides an iterator that iterates over the elements in insertion order. |
123 */ | 124 */ |
124 Iterator<E> get iterator; | 125 Iterator<E> get iterator; |
125 } | 126 } |
OLD | NEW |