ConcurrentTokenizedPriorityQueue<TKey, TValue, TToken>.AddOrUpdate(TToken, KeyValuePair<TKey, TValue>, Func<TToken, KeyValuePair<TKey, TValue>, KeyValuePair<TKey, 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.CollectionsAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3261.0 (4.8.3261.0)
Syntaxpublic 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 KeyValuePair<TKey, TValue>
- The key/value pair that should be added if the provided token is not present in the queue.
- updateFactory Func<TToken, KeyValuePair<TKey, TValue>, KeyValuePair<TKey, 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
KeyValuePair<TKey,
TValue>The key/value pair that was used. Either the
addValue, or the key/value pair used for update.
Exceptions
See Also