A Map of objects that can be ordered relative to each other.
The map is based on a self-balancing binary tree. It allows most operations in amortized logarithmic time.
Keys of the map are compared using the compare
function passed in
the constructor, both for ordering and for equality.
If the map contains only the key a
, then map.containsKey(b)
will return true
if and only if compare(a, b) == 0
,
and the value of a == b
is not even checked.
If the compare function is omitted, the objects are assumed to be
Comparable, and are compared using their Comparable.compareTo method.
Non-comparable objects (including null
) will not work as keys
in that case.
To allow calling operator [], remove or containsKey with objects
that are not supported by the compare
function, an extra isValidKey
predicate function can be supplied. This function is tested before
using the compare
function on an argument value that may not be a K
value. If omitted, the isValidKey
function defaults to testing if the
value is a K
.
other
. [...]
iterable
. [...]
keys
to values
. [...]
other
.
other
to this map. [...]
key
. [...]
value
. [...]
null
if the map is empty.
key
. Returns
null
if no key was not found.
f
to each key/value pair of the map. [...]
null
if the map is empty.
key
. Returns
null
if no key was not found.
key
, or add a new value if it isn't there. [...]
key
and its associated value, if present, from the map. [...]
newEntries
to this map. [...]
RK
keys and RV
instances,
if necessary. [...]
f
function.
predicate
.
key
. [...]
key
or null if key
is not in the map. [...]
key
with the given value
. [...]