Open
Description
Location
HashMap
Summary
HashMap implements FromIterator and Extend, but does not document what happens if there are duplicate keys in the iterator. The documentation for Extend does say "When extending a collection with an already existing key, that entry is updated", but
- that isn't visible anywhere on the HashMap page,
- FromIterator doesn't have to be implemented using Extend (though HashMap's is), and
- that still doesn't specify behavior for duplicate keys in the iterator itself.
The current implementation silently takes the last value in the iterator, which is useful behavior and could easily be justified by saying "collection.extend(a).extend(b)
should always be equivalent to collection.extend(a.chain(b))
", but technically that isn't written down anywhere.