Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: sdk/lib/collection/linked_hash_set.dart

Issue 16285004: Better documentation on Sets and Maps, and more. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: A few more documentation tweaks Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/collection/linked_hash_set.dart
diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart
index ee9cdb14e2eac704fcfebb5515b2b9065bbd28d3..28b7ce26d204cb0e03ca7a317549e2b9ccd14c58 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -4,6 +4,23 @@
part of dart.collection;
+/**
+ * A [LinkedHashSet] is a hash-table based [Set] implementation.
+ *
+ * The `LinkedHashSet` also keep track of the order that elements were inserted
+ * in, and iteration happens in first-to-last insertion order.
+ *
+ * The elements of a `LinkedHashSet` must have consistent [Object.operator==]
+ * and [Object.hashCode] implementations. This means that the `==` operator
+ * must define a stable equivalence relation on the elements (reflexive,
+ * anti-symmetric, transitive, and consistent over time), and that `hashCode`
+ * must be the same for objects that are considered equal by `==`.
+ *
+ * The set allows `null` as an element.
+ *
+ * Most simple operations on `HashSet` are done in constant time: [add],
+ * [contains], [remove], and [length].
+ */
class LinkedHashSet<E> extends _HashSetBase<E> {
external LinkedHashSet();
@@ -13,6 +30,8 @@ class LinkedHashSet<E> extends _HashSetBase<E> {
}
// Iterable.
+
+ /** Return an iterator that iterates over elements in insertion order. */
external Iterator<E> get iterator;
external int get length;
@@ -23,6 +42,7 @@ class LinkedHashSet<E> extends _HashSetBase<E> {
external bool contains(Object object);
+ /** Perform an operation on each element in insertion order. */
external void forEach(void action(E element));
external E get first;

Powered by Google App Engine
This is Rietveld 408576698