withNewToken

fun withNewToken(block: (T) -> V): V

Creates an new token and calls block with the token as lambda argument. The returned value of block is associated to the token.

If block throws, the associated value of the token, if any, is removed from the map.

Return

The returned value of block.