BiMap.put_new_value
You're seeing just the function
put_new_value
, go back to BiMap module for more information.
Specs
Inserts {key, value}
pair into bimap
if value
is not already in bimap
.
If value
already exists in bimap
, bimap
is returned unchanged.
If value
does not exist and key
is already in bimap
, any overlapping bindings are
deleted.
Examples
iex> bimap = BiMap.new
#BiMap<[]>
iex> bimap = BiMap.put_new_value(bimap, :a, 0)
#BiMap<[a: 0]>
iex> bimap = BiMap.put_new_value(bimap, :a, 1)
#BiMap<[a: 1]>
iex> BiMap.put_new_value(bimap, :b, 1)
#BiMap<[a: 1]>
iex> BiMap.put_new_value(bimap, :c, 2)
#BiMap<[a: 1, c: 2]>