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

Unified Diff: lib/src/canonicalized_map.dart

Issue 1638163002: Modernize the package's style. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: Code review changes Created 4 years, 11 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
« no previous file with comments | « lib/src/algorithms.dart ('k') | lib/src/comparators.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/canonicalized_map.dart
diff --git a/lib/src/canonicalized_map.dart b/lib/src/canonicalized_map.dart
index 21fb83dc673173d58109781c4d607fe956f8e23b..d967f70d005b5fafd981b4755a4e18b93438b1bf 100644
--- a/lib/src/canonicalized_map.dart
+++ b/lib/src/canonicalized_map.dart
@@ -2,22 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library dart.pkg.collection.canonicalized_map;
-
import 'dart:collection';
import 'utils.dart';
-/**
- * A map whose keys are converted to canonical values of type `C`.
- *
- * This is useful for using case-insensitive String keys, for example. It's more
- * efficient than a [LinkedHashMap] with a custom equality operator because it
- * only canonicalizes each key once, rather than doing so for each comparison.
- *
- * By default, `null` is allowed as a key. It can be forbidden via the
- * `isValidKey` parameter.
- */
+/// A map whose keys are converted to canonical values of type `C`.
+///
+/// This is useful for using case-insensitive String keys, for example. It's
+/// more efficient than a [LinkedHashMap] with a custom equality operator
+/// because it only canonicalizes each key once, rather than doing so for each
+/// comparison.
+///
+/// By default, `null` is allowed as a key. It can be forbidden via the
+/// `isValidKey` parameter.
class CanonicalizedMap<C, K, V> implements Map<K, V> {
final Function _canonicalize;
@@ -25,31 +22,27 @@ class CanonicalizedMap<C, K, V> implements Map<K, V> {
final _base = new Map<C, Pair<K, V>>();
- /**
- * Creates an empty canonicalized map.
- *
- * The [canonicalize] function should return the canonical value for the given
- * key. Keys with the same canonical value are considered equivalent.
- *
- * The [isValidKey] function is called before calling [canonicalize] for
- * methods that take arbitrary objects. It can be used to filter out keys that
- * can't be canonicalized.
- */
+ /// Creates an empty canonicalized map.
+ ///
+ /// The [canonicalize] function should return the canonical value for the
+ /// given key. Keys with the same canonical value are considered equivalent.
+ ///
+ /// The [isValidKey] function is called before calling [canonicalize] for
+ /// methods that take arbitrary objects. It can be used to filter out keys
+ /// that can't be canonicalized.
CanonicalizedMap(C canonicalize(K key), {bool isValidKey(Object key)})
: _canonicalize = canonicalize,
_isValidKeyFn = isValidKey;
- /**
- * Creates a canonicalized map that is initialized with the key/value pairs of
- * [other].
- *
- * The [canonicalize] function should return the canonical value for the given
- * key. Keys with the same canonical value are considered equivalent.
- *
- * The [isValidKey] function is called before calling [canonicalize] for
- * methods that take arbitrary objects. It can be used to filter out keys that
- * can't be canonicalized.
- */
+ /// Creates a canonicalized map that is initialized with the key/value pairs
+ /// of [other].
+ ///
+ /// The [canonicalize] function should return the canonical value for the
+ /// given key. Keys with the same canonical value are considered equivalent.
+ ///
+ /// The [isValidKey] function is called before calling [canonicalize] for
+ /// methods that take arbitrary objects. It can be used to filter out keys
+ /// that can't be canonicalized.
CanonicalizedMap.from(Map<K, V> other, C canonicalize(K key),
{bool isValidKey(Object key)})
: _canonicalize = canonicalize,
« no previous file with comments | « lib/src/algorithms.dart ('k') | lib/src/comparators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698