libweave: Simplify NotifyPropertiesUpdated a little

Replaced code with smaller equivalent.

BUG=none
TEST='FEATURES=test emerge-gizmo buffet'

Change-Id: I735859b371b7e7abc45a8d5e915df7d16480d583
Reviewed-on: https://chromium-review.googlesource.com/289302
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
Trybot-Ready: David James <davidjames@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/libweave/src/states/state_change_queue.cc b/libweave/src/states/state_change_queue.cc
index fbce5d8..345e532 100644
--- a/libweave/src/states/state_change_queue.cc
+++ b/libweave/src/states/state_change_queue.cc
@@ -16,17 +16,12 @@
 bool StateChangeQueue::NotifyPropertiesUpdated(base::Time timestamp,
                                                ValueMap changed_properties) {
   DCHECK(thread_checker_.CalledOnValidThread());
-  auto it = state_changes_.lower_bound(timestamp);
-  if (it == state_changes_.end() || it->first != timestamp) {
-    // This timestamp doesn't exist. Insert a new element.
-    state_changes_.emplace_hint(it, timestamp, std::move(changed_properties));
-  } else {
-    // Merge the old property set and the new one.
-    // For properties that exist in both old and new property sets, keep the
-    // new values.
-    changed_properties.insert(it->second.begin(), it->second.end());
-    it->second = std::move(changed_properties);
-  }
+
+  auto& stored_changes = state_changes_[timestamp];
+  // Merge the old property set.
+  changed_properties.insert(stored_changes.begin(), stored_changes.end());
+  stored_changes = std::move(changed_properties);
+
   while (state_changes_.size() > max_queue_size_) {
     // Queue is full.
     // Merge the two oldest records into one. The merge strategy is: