Dictionary.from_vector
Dictionary.from_vectorvecerror_on_duplicates
Group: Constants
Aliases: dictionary
, lookup table
Documentation
Builds a dictionary from a vector of key-value pairs, with each key-value pair represented as a 2 element vector.
Arguments
vec
: A vector of key-value pairs (2 element vectors).error_on_duplicates
: A flag which specifies if duplicate keys on the input vector should result in an error. By default, set toTrue
, meaning that if two entries in the vector share the same key, anIllegal_Argument
error is raised. If set toFalse
, the last entry with a given key will be kept.
Examples
Building a dictionary containing two key-value pairs.
example_from_vector = Dictionary.from_vector [["A", 1], ["B", 2]]