merge

open fun merge(other: ActualWrapper, transform: Merge<BackingField>): ActualWrapper

Merges this Boxed instance with another Boxed instance to create a new instance of the same type.

Specifically, this function unwraps the backing field of the receiver and the other instance, applies the transform function to both fields, and wraps the resulting value in a new instance of this type.

Return

A new instance of the same type as the receiver, wrapping the result of transform.

Parameters

other

The Boxed instance to merge with this instance. It must be of the same type.

transform

A function to combine the backing fields of this instance and other. The function takes two parameters: the receiver's backing field and other's backing field.