Abstract supertype of objects which associate values with
keys. A Correspondence<Key,Item>
may be a viewed as a
partial function from domain Key
to range Item
, where
some Key
s have no Item
.
Correspondence
does not satisfy Category
, since in
some cases—List
, for example—it is convenient
to consider the subtype a Category
of its indexed items,
and in other cases—Map
, for example—it is
convenient to treat the subtype as a Category
of its
entries.
The item corresponding to a given key may be obtained from
a Correspondence
using the item operator:
value bg = settings["backgroundColor"] else white;
The get()
operation and item operator result in an
optional type, to reflect the possibility that there may be
no item for the given key.
no type hierarchy
no supertypes hierarchy
Attributes | |
keys | Source Codeshared default Category<Key> keys The See also defines() |
Inherited Attributes |
Attributes inherited from: Object |
Methods | |
defines | Source Codeshared formal Boolean defines(Key key) Determines if there is a value defined for the given key. See also definesAny() , definesEvery() , keys |
definesAny | Source Codeshared default Boolean definesAny({Key*} keys) Determines if this See also defines() |
definesEvery | Source Codeshared default Boolean definesEvery({Key*} keys) Determines if this See also defines() |
get | Source Codeshared formal Item? get(Key key) Returns the value defined for the given key, or For any instance c[key] See also getAll() |
getAll | Source Codeshared default Iterable<Item?,Absent> getAll<Absent>(Iterable<Key,Absent> keys) Returns the items defined for the given keys, in the
same order as the corresponding keys. For any key which
does not have an item defined, the resulting stream
contains the value See also get() Since 1.1.0 |
Inherited Methods |
Methods inherited from: Object |