Class: Toybox.Lang.Dictionary
- Inherits:
-
Toybox.Lang.Object
Overview
A Dictionary is a hash table or associative array used to map keys to values.
Both the keys and values can be any Object type, though they do not all need to be of the same type. Objects used as a keys should override the hashCode() method. Due to the nature of hash tables, the order of Dictionary elements are not guaranteed to match the insertion order.
See Also:
Instance Method Summary collapse
-
get(key as Lang.Object) as Lang.Object or Null
Retrieve a value from a Dictionary for a given key.
-
hasKey(key as Lang.Object) as Lang.Boolean
Determine whether a key exists within a Dictionary.
-
isEmpty() as Lang.Boolean
Determine whether a Dictionary is empty.
-
keys() as Lang.Array<Lang.Object>
Retrieve the keys in the Dictionary.
-
put(key as Lang.Object, value as Lang.Object or Null) as Void
Place a value in the Dictionary with a given key.
-
remove(key as Lang.Object) as Void
Delete an item from a Dictionary.
-
size() as Lang.Number
Retrieve the number of elements in a Dictionary.
-
toString() as Lang.String
Convert a Dictionary to a String.
-
values() as Lang.Array<Lang.Object or Null>
Retrieve the values in the Dictionary.
Instance Method Details
get(key as Lang.Object) as Lang.Object or Null
Retrieve a value from a Dictionary for a given key.
hasKey(key as Lang.Object) as Lang.Boolean
Determine whether a key exists within a Dictionary.
isEmpty() as Lang.Boolean
Determine whether a Dictionary is empty.
keys() as Lang.Array<Lang.Object>
Retrieve the keys in the Dictionary.
put(key as Lang.Object, value as Lang.Object or Null) as Void
Place a value in the Dictionary with a given key.
remove(key as Lang.Object) as Void
Delete an item from a Dictionary.
size() as Lang.Number
Retrieve the number of elements in a Dictionary.
toString() as Lang.String
Convert a Dictionary to a String.
Due to the nature of hash tables, the order of Dictionary elements are not guaranteed to match the insertion order when converting to a String.
values() as Lang.Array<Lang.Object or Null>
Retrieve the values in the Dictionary.