A right-biased map operation resolves duplicate keys by selecting the value from the right-hand map. It provides a concise default when collisions do not require custom combination logic. section 9.3.4
Listing 9.36 An exercise in tedium
UnbalancedCart refreshCart(ValidCart cart) {
return new UnbalancedCart(
cart.active().values().stream() #A
.map(this::preloadEverythingWeNeed)
.collect(toMap(ProductSeller::fromItem, Function.identity()),
cart.active().values().stream() #B
.map(this::preloadEverythingWeNeed) #B
.collect(toMap(ProductSeller::fromItem, Function.identity()), #B
);
}The intersection utility delegates collision handling to a binary operation; its right-biased overload supplies the right value directly. section 9.3.4
Right-Biased Union
A right-biased union combines all keys from two maps while replacing any shared key’s value with the value from the second map.
