Emojicode Documentation 1.0 beta 2

Value Type 🍯🐚ElementβšͺοΈπŸ†

Dictionary, holding key value pairs.

Dictionaries allow you to associate keys with values. 🍯 is implemented as a hash table and is O(1) on average and O(n) in worst case.

🍯 is a value type. This means that copies of 🍯 are independent:

🍿 πŸ”€JaneπŸ”€ ➑️ 45 πŸ”€SharonπŸ”€ ➑️ 22 πŸ”€BobπŸ”€ ➑️ 64 πŸ† ➑️ ages
ages ➑️ πŸ–πŸ†•agesCopy
46 ➑️ 🐽agesCopy πŸ”€JaneπŸ”€β—οΈ

In the above example the dictionary in ages will still contain 45 for the key πŸ”€JaneπŸ”€ as only agesCopy was modified.

To learn more about collection literals see the Language Reference.

Initializers

πŸ†•

πŸ–  πŸ†• 

Creates an empty 🍯.

πŸ†•β–ΆοΈπŸ΄

πŸ–  πŸ†•β–ΆοΈπŸ΄  minCapacity πŸ”’ 

Creates an empty 🍯 with a capacity of at least minCapacity.

πŸ†•β–ΆοΈπŸͺ

☣️ πŸ–  πŸ†•β–ΆοΈπŸͺ  keys 🧠  values 🧠  count πŸ”’ 

Methods

πŸ½β—οΈ

❗️ 🐽  key πŸ”‘ ➑️ 🍬Element

Returns the value assigned to key. If key is not in the 🍯, no value is returned.

πŸ¨β—οΈ

πŸ– ❗️ 🐨  key πŸ”‘ 

Removes key and its assigned value from the 🍯. No action is performed if key is not in the 🍯.

🐽➑️

πŸ– ➑️ 🐽 🎍πŸ₯‘ value Element 🎍πŸ₯‘ key πŸ”‘ 

Assings a value to the provided key.

πŸ™β—οΈ

❗️ πŸ™ ➑️ πŸ¨πŸšπŸ”‘πŸ†

Returns a list consisting of all keys in this 🍯.

Caution

Note that the keys in the returned list are arbitrarily ordered.

πŸ—β—οΈ

πŸ– ❗️ πŸ— ➑️ πŸ”’

Removes all key-value pairs in this 🍯 and returns the number of deleted items.

πŸ£β—οΈ

❗️ 🐣  key πŸ”‘ ➑️ πŸ‘Œ

Checks whether key is in this 🍯.

πŸ“β“

❓ πŸ“ ➑️ πŸ”’

Returns the number of items.

Type Methods

πŸ›·

πŸ– πŸ‡β—οΈ πŸ›·  n πŸ”’ ➑️ πŸ”’