ceylon.language.Entry.ceylon Maven / Gradle / Ivy
"A pair containing a _key_ and an associated value called
the _item_. Used primarily to represent the elements of a
[[Map]]. The type `Entry` may be abbreviated
`Key->Item`. An instance of `Entry` may be constructed
using the `->` operator:
String->Person entry = person.name->person;"
by ("Gavin")
tagged("Collections")
shared final serializable
class Entry(key, item)
extends Object()
given Key satisfies Object {
"The key used to access the entry."
shared Key key;
"The item associated with the key."
shared Item item;
"A pair (2 element tuple) with the key and item of this
entry. For any `entry`:
entry.pair == [entry.key,entry.item]"
shared [Key, Item] pair => [key, item];
"An `Entry` with the key and item of this entry if this
entry's item is non-null, or `null` otherwise."
shared Item&Object>? coalesced
=> if (exists item) then key->item else null;
"Determines if this entry is equal to the given entry.
Two entries are equal if they have the same key and
the same item.
- The keys are considered the same if they are equal,
in the sense of [[value equality|Object.equals]].
- Two items are considered the same if they are both
null or if neither is null and they are equal."
shared actual Boolean equals(Object that) {
if (is Entry
© 2015 - 2024 Weber Informatics LLC | Privacy Policy