Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

OrInsertWith

func OrInsertWith(factory: () -> V) -> V

Declaring type: MapEntry<K, V>
Module: System.Collections
Assembly: System.Runtime.dll
Source file: MapEntry.rvn

Calls the factory once only when absent, then inserts if still absent.

Parameters

Name Type Description
factory Function A synchronous factory; may reenter the map.

Return value

V

The current value if present after the factory; otherwise its inserted result.

Remarks

Callback insertion wins. A callback fault propagates before this helper writes; callback side effects are not rolled back.