update

open fun update(computeNewValue: (T) -> T): T

Updates the current value using the specified transformation function and returns the previous value.

Return

The previous value before the update.

Parameters

computeNewValue

A function that computes the new value based on the current value.