Search Results for

    / fm / liveswitch / ManagedConcurrentDictionary

    Class: ManagedConcurrentDictionary<TKey, TValue>

    fm.liveswitch.ManagedConcurrentDictionary

    A ConcurrentDictonary that maps to the appropriate platform version.

    Type parameters

    Name
    TKey
    TValue

    Table of contents

    Constructors

    • constructor

    Methods

    • addOrUpdate
    • clear
    • containsKey
    • getCount
    • getIsEmpty
    • getKeys
    • getOrAdd
    • getTypeString
    • getValues
    • tryAdd
    • tryGetValue
    • tryRemove
    • tryUpdate

    Constructors

    constructor

    + new ManagedConcurrentDictionary<TKey, TValue>(): ManagedConcurrentDictionary<TKey, TValue>

    Creates a new instance.

    Type parameters:

    Name
    TKey
    TValue

    Returns: ManagedConcurrentDictionary<TKey, TValue>

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:13

    + new ManagedConcurrentDictionary<TKey, TValue>(hashCallback: IFunction1<TKey, string>): ManagedConcurrentDictionary<TKey, TValue>

    Creates a new ManagedConcurrentDictionary.

    Type parameters:

    Name
    TKey
    TValue

    Parameters:

    Name Type Description
    hashCallback IFunction1<TKey, string> The hash function to use when the backing dictionary requires the key to be a string.

    Returns: ManagedConcurrentDictionary<TKey, TValue>

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:20

    Methods

    addOrUpdate

    ▸ addOrUpdate(key: TKey, addValue: TValue): TValue

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

    Parameters:

    Name Type Description
    key TKey The key to use for updating for adding.
    addValue TValue The value to be added for an absent key.

    Returns: TValue

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:65

    ▸ addOrUpdate(key: TKey, addValue: TValue, updateValueFactory: IFunction2<TKey, TValue, TValue>): TValue

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

    Parameters:

    Name Type Description
    key TKey The key to use for updating for adding.
    addValue TValue The value to be added for an absent key.
    updateValueFactory IFunction2<TKey, TValue, TValue> The function to use for generating a value based on an existing key.

    Returns: TValue

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:74


    clear

    ▸ clear(): void

    Clears the dictionary of all items.

    Returns: void

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:98


    containsKey

    ▸ containsKey(key: TKey): boolean

    True if the dictionary contains the key.

    Parameters:

    Name Type Description
    key TKey The key to check.

    Returns: boolean

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:111


    getCount

    ▸ getCount(): number

    Gets the number of items in the dictionary.

    Returns: number

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:123


    getIsEmpty

    ▸ getIsEmpty(): boolean

    Gets true if dictionary is empty.

    Returns: boolean

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:135


    getKeys

    ▸ getKeys(): TKey[]

    Gets an array of keys.

    Returns: TKey[]

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:147


    getOrAdd

    ▸ getOrAdd(key: TKey, valueFactory: IFunction1<TKey, TValue>): TValue

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

    Parameters:

    Name Type Description
    key TKey The key to use when adding to the dictionary.
    valueFactory IFunction1<TKey, TValue> The Func that will create a value if needed.

    Returns: TValue

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

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:162


    getTypeString

    ▸ getTypeString(): string

    Returns: string

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:9


    getValues

    ▸ getValues(): TValue[]

    Gets an array of Values.

    Returns: TValue[]

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:176


    tryAdd

    ▸ tryAdd(key: TKey, value: TValue): boolean

    Tries to add a new value to the dictionary.

    Parameters:

    Name Type Description
    key TKey The key to use when adding.
    value TValue The value to be added to the dictionary.

    Returns: boolean

    True if added, false if key already exists.

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:199


    tryGetValue

    ▸ tryGetValue(key: TKey, value: Holder<TValue>): boolean

    Tries to get a value from the dictionary.

    Parameters:

    Name Type Description
    key TKey They key of the item to get form the dictionary.
    value Holder<TValue> The value that was just received or null if failed.

    Returns: boolean

    True if succeeded.

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:214


    tryRemove

    ▸ tryRemove(key: TKey): boolean

    Tries and removes a value from the dictionary.

    Parameters:

    Name Type Description
    key TKey The key of the item to remove.

    Returns: boolean

    True if successful.

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:229

    ▸ tryRemove(key: TKey, value: Holder<TValue>): boolean

    Tries and removes a value from the dictionary.

    Parameters:

    Name Type Description
    key TKey The key of the item to remove.
    value Holder<TValue> The value that was just removed.

    Returns: boolean

    True if successful.

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:238


    tryUpdate

    ▸ tryUpdate(key: TKey, newValue: TValue, comparisonValue: TValue): boolean

    Tries to update the value in the dictionary.

    Parameters:

    Name Type Description
    key TKey The key to use when updating.
    newValue TValue The new value.
    comparisonValue TValue The value to compare with the current value in the dictionary.

    Returns: boolean

    True if succeeded.

    Defined in: Generated/TypeScript/fm.liveswitch/ManagedConcurrentDictionary.ts:265

    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.14.6