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