Click or drag to resize

ConcurrentTokenizedPriorityQueueTKey, TValue, TTokenAddOrUpdate(TToken, KeyValuePairTKey, TValue, FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue) Method

Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public KeyValuePair<TKey, TValue> AddOrUpdate(
	TToken token,
	KeyValuePair<TKey, TValue> addValue,
	Func<TToken, KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>> updateFactory
)

Parameters

token  TToken
The token.
addValue  KeyValuePairTKey, TValue
The key/value pair that should be added if the provided token is not present in the queue.
updateFactory  FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue
A function that generates a new key/value pair that should be used to update the key/value pair associated with the provided token if it is already present in the queue.

Return Value

KeyValuePairTKey, TValue
The key/value pair that was used. Either the addValue, or the key/value pair used for update.
Exceptions
ExceptionCondition
InvalidOperationExceptionThis queue is generating tokens by itself. Use Enqueue(key, value) instead!
See Also