MapCollection.d
Originally written by Doug Lea and released into the public domain.
Thanks for the assistance and support of Sun Microsystems Labs, Agorics
Inc, Loral, and everyone contributing, testing, and using this code.
Date Who What
13Oct95 dl Create
28jan97 dl make class public
14Dec06 kb adapted for Tango usage
- class MapCollection(K, T) : Collection!(T), Map!(K, T) ¶#
-
MapCollection extends Collection to provide default implementations of
some Map operations.
Doug Lea
@version 0.93
For an introduction to this package see Overview .
- this() [protected] ¶#
-
Initialize at version 0, an empty count, and null screener
- this(Predicate screener) [protected] ¶#
-
Initialize at version 0, an empty count, and supplied screener
- bool allowsKey(K key) [public, final] ¶#
-
Implements tango.util.collection.Map.allowsKey.
Default key-screen. Just checks for null.
tango.util.collection.Map.allowsKey
- void checkKey(K key) [protected, final] ¶#
-
Principal method to throw a IllegalElementException for keys
- void opIndexAssign(T element, K key) [public, final] ¶#
-
Implements tango.util.collection.impl.MapCollection.MapCollection.opIndexAssign
Just calls add(key, element).
tango.util.collection.impl.MapCollection.MapCollection.add
- bool matches(View!(T) other) [public, override] ¶#
-
Implements tango.util.collection.impl.Collection.Collection.matches
Time complexity: O(n).
Default implementation. Fairly sleazy approach.
(Defensible only when you remember that it is just a default impl.)
It tries to cast to one of the known collection interface types
and then applies the corresponding comparison rules.
This suffices for all currently supported collection types,
but must be overridden if you define new Collection subinterfaces
and/or implementations.
tango.util.collection.impl.Collection.Collection.matches
- void removeAll(Iterator!(T) e) [public] ¶#
-
Implements tango.util.collection.impl.Collection.Collection.removeAll
tango.util.collection.impl.Collection.Collection.removeAll
Has to be here rather than in the superclass to satisfy
D interface idioms
- void remove(Iterator!(T) e) [public] ¶#
-
Implements tango.util.collection.impl.Collection.Collection.removeElements
tango.util.collection.impl.Collection.Collection.removeElements
Has to be here rather than in the superclass to satisfy
D interface idioms