dict.eh

Dictionaries. More...

use "dict.eh"

Types

type Dict < Any;

Functions

def Dict.clear();
def Dict.get(key: Any): Any;
def Dict.keys(): [Any];
def Dict.new(): Dict;
def Dict.remove(key: Any);
def Dict.set(key: Any, val: Any);
def Dict.size(): Int;
def Dict.tostr(): String;

Description

Dictionary is a set of key-value pairs. All keys are unique within one dictionary. Every non-null value can be used as a key or as a value.

Dictionaries support syntax similar to that of arrays.

var dict = new Dict()
dict["Name"] = "John"
dict["Surname"] = "Doe"

Type details

type Dict < Any;
A dictionary.

Function details

def Dict.new(): Dict;
Creates new empty dictionary.

def Dict.set(key: Any, val: Any);
Maps given key to specified value.

def Dict.get(key: Any): Any;
Returns value to which given key is mapped in the dictionary. Returns null if the key is not stored in dictionary.

def Dict.remove(key: Any);
Removes specified key and its corresponding value from the dictionary. Does nothing if dictionary does not contain given key.

def Dict.clear();
Removes all keys and values from this dictionary.

def Dict.keys(): [Any];
Returns all keys currently stored in the dictionary.

def Dict.size(): Int;
Returns number of pairs in this dictionary.

def Dict.tostr(): String;
Returns string representation for this dictionary. Returned string has the form
"{key1=value1, key2=value2, ...}".