FMLiveSwitchManagedConcurrentDictionary Class Reference

A ConcurrentDictonary that maps to the appropriate platform version. More...

Instance Methods

(TValue) - addOrUpdateWithKey:addValue:updateValueFactory:
 Updates a value in the dictionary or adds it if it does not exist. More...
 
(TValue) - addOrUpdateWithKey:addValue:updateValueFactoryBlock:
 Updates a value in the dictionary or adds it if it does not exist. More...
 
(TKey, TValue) - addOrUpdateWithKeyAndAddValueAndUpdateValueFactoryBlock
 Updates a value in the dictionary or adds it if it does not exist. More...
 
(void) - clear
 Clears the dictionary of all items. More...
 
(bool) - containsKey:
 True if the dictionary contains the key. More...
 
(int) - count
 Gets the number of items in the dictionary. More...
 
(TValue) - getOrAddWithKey:valueFactory:
 Gets the value from the dictionary or adds a new one if it does not exist. More...
 
(TValue) - getOrAddWithKey:valueFactoryBlock:
 Gets the value from the dictionary or adds a new one if it does not exist. More...
 
(TKey) - getOrAddWithKeyAndValueFactoryBlock
 Gets the value from the dictionary or adds a new one if it does not exist. More...
 
(instancetype) - init
 Creates a new instance. More...
 
(instancetype) - initWithHashCallback:
 Creates a new ManagedConcurrentDictionary. More...
 
(instancetype) - initWithHashCallbackBlock:
 Creates a new ManagedConcurrentDictionary. More...
 
(bool) - isEmpty
 Gets true if dictionary is empty. More...
 
(NSMutableArray< TKey > *) - keys
 Gets an array of keys. More...
 
(bool) - tryAddWithKey:value:
 Tries to add a new value to the dictionary. More...
 
(bool) - tryGetValueWithKey:value:
 Tries to get a value from the dictionary. More...
 
(bool) - tryRemoveWithKey:
 Tries and removes a value from the dictionary. More...
 
(bool) - tryRemoveWithKey:value:
 Tries and removes a value from the dictionary. More...
 
(bool) - tryUpdateWithKey:newValue:comparisonValue:
 Tries to update the value in the dictionary. More...
 
(NSMutableArray< TValue > *) - values
 Gets an array of Values. More...
 

Class Methods

(FMLiveSwitchManagedConcurrentDictionary *) + managedConcurrentDictionary
 Creates a new instance. More...
 
(FMLiveSwitchManagedConcurrentDictionary *) + managedConcurrentDictionaryWithHashCallback:
 Creates a new ManagedConcurrentDictionary. More...
 
(FMLiveSwitchManagedConcurrentDictionary *) + managedConcurrentDictionaryWithHashCallbackBlock:
 Creates a new ManagedConcurrentDictionary. More...
 

Protected Attributes

 __pad0__: NSObject- (TValue) addOrUpdateWithKey:(TKey)key addValue:(TValue)addValue
 

Detailed Description

A ConcurrentDictonary that maps to the appropriate platform version.

Method Documentation

◆ addOrUpdateWithKey:addValue:updateValueFactory:

- (TValue) addOrUpdateWithKey: (TKey)  key
addValue: (TValue)  addValue
updateValueFactory: (FMLiveSwitchFunction2< TKey, TValue, TValue > *)  updateValueFactory 

Updates a value in the dictionary or adds it if it does not exist.

Parameters
keyThe key to use for updating for adding.
addValueThe value to be added for an absent key.
updateValueFactoryThe function to use for generating a value based on an existing key.

◆ addOrUpdateWithKey:addValue:updateValueFactoryBlock:

- (TValue) addOrUpdateWithKey: (TKey)  key
addValue: (TValue)  addValue
updateValueFactoryBlock: (TValue(^)(TKey, TValue))  updateValueFactoryBlock 

Updates a value in the dictionary or adds it if it does not exist.

Parameters
keyThe key to use for updating for adding.
addValueThe value to be added for an absent key.
updateValueFactoryBlockThe function to use for generating a value based on an existing key.

◆ addOrUpdateWithKeyAndAddValueAndUpdateValueFactoryBlock

- (TKey, TValue) addOrUpdateWithKeyAndAddValueAndUpdateValueFactoryBlock

Updates a value in the dictionary or adds it if it does not exist.

@inlineparam key The key to use for updating for adding. @inlineparam addValue The value to be added for an absent key. @inlineparam updateValueFactoryBlock The function to use for generating a value based on an existing key.

◆ clear

- (void) clear

Clears the dictionary of all items.

◆ containsKey:

- (bool) containsKey: (TKey)  key

True if the dictionary contains the key.

Parameters
keyThe key to check.

◆ count

- (int) count

Gets the number of items in the dictionary.

◆ getOrAddWithKey:valueFactory:

- (TValue) getOrAddWithKey: (TKey)  key
valueFactory: (FMLiveSwitchFunction1< TKey, TValue > *)  valueFactory 

Gets the value from the dictionary or adds a new one if it does not exist.

Parameters
keyThe key to use when adding to the dictionary.
valueFactoryThe Func that will create a value if needed.
Returns
The dictionary value if exist, the value returned by the Func if not.

◆ getOrAddWithKey:valueFactoryBlock:

- (TValue) getOrAddWithKey: (TKey)  key
valueFactoryBlock: (TValue(^)(TKey))  valueFactoryBlock 

Gets the value from the dictionary or adds a new one if it does not exist.

Parameters
keyThe key to use when adding to the dictionary.
valueFactoryBlockThe Func that will create a value if needed.
Returns
The dictionary value if exist, the value returned by the Func if not.

◆ getOrAddWithKeyAndValueFactoryBlock

- (TKey) getOrAddWithKeyAndValueFactoryBlock

Gets the value from the dictionary or adds a new one if it does not exist.

@inlineparam key The key to use when adding to the dictionary. @inlineparam valueFactoryBlock The Func that will create a value if needed.

Returns
The dictionary value if exist, the value returned by the Func if not.

◆ init

- (instancetype) init

Creates a new instance.

◆ initWithHashCallback:

- (instancetype) initWithHashCallback: (FMLiveSwitchFunction1< TKey, NSString * > *)  hashCallback

Creates a new ManagedConcurrentDictionary.

Parameters
hashCallbackThe hash function to use when the backing dictionary requires the key to be a string.

◆ initWithHashCallbackBlock:

- (instancetype) initWithHashCallbackBlock: (NSString *(^)(TKey))  hashCallbackBlock

Creates a new ManagedConcurrentDictionary.

Parameters
hashCallbackBlockThe hash function to use when the backing dictionary requires the key to be a string.

◆ isEmpty

- (bool) isEmpty

Gets true if dictionary is empty.

◆ keys

- (NSMutableArray<TKey>*) keys

Gets an array of keys.

◆ managedConcurrentDictionary

+ (FMLiveSwitchManagedConcurrentDictionary*) managedConcurrentDictionary

Creates a new instance.

◆ managedConcurrentDictionaryWithHashCallback:

+ (FMLiveSwitchManagedConcurrentDictionary*) managedConcurrentDictionaryWithHashCallback: (FMLiveSwitchFunction1< TKey, NSString * > *)  hashCallback

Creates a new ManagedConcurrentDictionary.

Parameters
hashCallbackThe hash function to use when the backing dictionary requires the key to be a string.

◆ managedConcurrentDictionaryWithHashCallbackBlock:

+ (FMLiveSwitchManagedConcurrentDictionary*) managedConcurrentDictionaryWithHashCallbackBlock: (NSString *(^)(TKey))  hashCallbackBlock

Creates a new ManagedConcurrentDictionary.

Parameters
hashCallbackBlockThe hash function to use when the backing dictionary requires the key to be a string.

◆ tryAddWithKey:value:

- (bool) tryAddWithKey: (TKey)  key
value: (TValue)  value 

Tries to add a new value to the dictionary.

Parameters
keyThe key to use when adding.
valueThe value to be added to the dictionary.
Returns
True if added, false if key already exists.

◆ tryGetValueWithKey:value:

- (bool) tryGetValueWithKey: (TKey)  key
value: (TValue *)  value 

Tries to get a value from the dictionary.

Parameters
keyThey key of the item to get form the dictionary.
valueThe value that was just received or null if failed.
Returns
True if succeeded.

◆ tryRemoveWithKey:

- (bool) tryRemoveWithKey: (TKey)  key

Tries and removes a value from the dictionary.

Parameters
keyThe key of the item to remove.
Returns
True if successful.

◆ tryRemoveWithKey:value:

- (bool) tryRemoveWithKey: (TKey)  key
value: (TValue *)  value 

Tries and removes a value from the dictionary.

Parameters
keyThe key of the item to remove.
valueThe value that was just removed.
Returns
True if successful.

◆ tryUpdateWithKey:newValue:comparisonValue:

- (bool) tryUpdateWithKey: (TKey)  key
newValue: (TValue)  newValue
comparisonValue: (TValue)  comparisonValue 

Tries to update the value in the dictionary.

Parameters
keyThe key to use when updating.
newValueThe new value.
comparisonValueThe value to compare with the current value in the dictionary.
Returns
True if succeeded.

◆ values

- (NSMutableArray<TValue>*) values

Gets an array of Values.

Member Data Documentation

◆ __pad0__

- __pad0__
protected