@@ -1093,6 +1093,9 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
1093
1093
1094
1094
/// Moves all elements from `other` into `self`, leaving `other` empty.
1095
1095
///
1096
+ /// If a key from `other` is already present in `self`, the respective
1097
+ /// value from `self` will be overwritten with the respective value from `other`.
1098
+ ///
1096
1099
/// # Examples
1097
1100
///
1098
1101
/// ```
@@ -1101,10 +1104,10 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
1101
1104
/// let mut a = BTreeMap::new();
1102
1105
/// a.insert(1, "a");
1103
1106
/// a.insert(2, "b");
1104
- /// a.insert(3, "c");
1107
+ /// a.insert(3, "c"); // Note: Key (3) also present in b.
1105
1108
///
1106
1109
/// let mut b = BTreeMap::new();
1107
- /// b.insert(3, "d");
1110
+ /// b.insert(3, "d"); // Note: Key (3) also present in a.
1108
1111
/// b.insert(4, "e");
1109
1112
/// b.insert(5, "f");
1110
1113
///
@@ -1115,7 +1118,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
1115
1118
///
1116
1119
/// assert_eq!(a[&1], "a");
1117
1120
/// assert_eq!(a[&2], "b");
1118
- /// assert_eq!(a[&3], "d");
1121
+ /// assert_eq!(a[&3], "d"); // Note: "c" has been overwritten.
1119
1122
/// assert_eq!(a[&4], "e");
1120
1123
/// assert_eq!(a[&5], "f");
1121
1124
/// ```
0 commit comments