diff --git a/Foundation/include/Poco/ListMap.h b/Foundation/include/Poco/ListMap.h index 81716bc0e..514fa7a74 100644 --- a/Foundation/include/Poco/ListMap.h +++ b/Foundation/include/Poco/ListMap.h @@ -140,19 +140,8 @@ public: /// Returns iterator pointing to the newly inserted value { Iterator it = find(val.first); - - if (it == _list.end()) - { - _list.push_back(val); - it = _list.end(); - --it; - } - else - { - _list.insert(it, 1, val); - } - - return it; + while (it != _list.end() && isEqual(it->first, val.first)) ++it; + return _list.insert(it, 1, val); } void erase(Iterator it)