core :: CoupleMap :: defaultinit
# Associative arrays that internally uses couples to represent each (key, value) pairs.
# This is an helper class that some specific implementation of Map may implements.
interface CoupleMap[K, V]
super Map[K, V]
# Return the couple of the corresponding key
# Return null if the key is no associated element
protected fun couple_at(key: nullable Object): nullable Couple[K, V] is abstract
# Return a new iteralot on all couples
# Used to provide `iterator` and others
protected fun couple_iterator: Iterator[Couple[K,V]] is abstract
redef fun iterator do return new CoupleMapIterator[K,V](couple_iterator)
redef fun [](key)
do
var c = couple_at(key)
if c == null then
return provide_default_value(key)
else
return c.second
end
end
redef fun has_key(key) do return couple_at(key) != null
end
lib/core/collection/abstract_collection.nit:1271,1--1297,3