Struct NativeMultiHashMap<TKey, TValue> | Collections | 0.4.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Struct NativeMultiHashMap<TKey, TValue>

    Namespace: Unity.Collections
    Syntax
    public struct NativeMultiHashMap<TKey, TValue> : IDisposable where TKey : struct, IEquatable<TKey> where TValue : struct
    Type Parameters
    Name Description
    TKey
    TValue

    Constructors

    NativeMultiHashMap(Int32, Allocator)

    Declaration
    public NativeMultiHashMap(int capacity, Allocator allocator)
    Parameters
    Type Name Description
    Int32 capacity
    Allocator allocator

    Properties

    Capacity

    The number of items that can fit in the container.

    Declaration
    public int Capacity { get; set; }
    Property Value
    Type Description
    Int32

    The number of items that the container can hold before it resizes its internal storage.

    Remarks

    Capacity specifies the number of items the container can currently hold. You can change Capacity to fit more or fewer items. Changing Capacity creates a new array of the specified size, copies the old array to the new one, and then deallocates the original array memory.

    IsCreated

    Reports whether memory for the container is allocated.

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    Boolean

    True if this container object's internal storage has been allocated.

    Remarks

    Note that the container storage is not created if you use the default constructor.

    Length

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    Int32

    Methods

    Add(TKey, TValue)

    Add an element with the specified key and value into the container. If the key already exist an ArgumentException will be thrown.

    Declaration
    public void Add(TKey key, TValue item)
    Parameters
    Type Name Description
    TKey key

    The key of the element to add.

    TValue item

    AsParallelWriter()

    Returns parallel writer instance.

    Declaration
    public NativeMultiHashMap<TKey, TValue>.ParallelWriter AsParallelWriter()
    Returns
    Type Description
    NativeMultiHashMap.ParallelWriter<>

    Clear()

    Clears the container.

    Declaration
    public void Clear()
    Remarks

    Containers capacity remains unchanged.

    ContainsKey(TKey)

    Declaration
    public bool ContainsKey(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    Boolean

    CountValuesForKey(TKey)

    Declaration
    public int CountValuesForKey(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    Int32

    Dispose()

    Disposes of this multi-hashmap and deallocates its memory immediately.

    Declaration
    public void Dispose()

    Dispose(JobHandle)

    Safely disposes of this container and deallocates its memory when the jobs that use it have completed.

    Declaration
    public JobHandle Dispose(JobHandle inputDeps)
    Parameters
    Type Name Description
    JobHandle inputDeps
    Returns
    Type Description
    JobHandle

    A new job handle containing the prior handles as well as the handle for the job that deletes the container.

    Remarks

    You can call this function dispose of the container immediately after scheduling the job. Pass the JobHandle returned by the Job.Schedule method using the jobHandle parameter so the job scheduler can dispose the container after all jobs using it have run.

    GetKeyArray(Allocator)

    Declaration
    public NativeArray<TKey> GetKeyArray(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator
    Returns
    Type Description
    NativeArray<TKey>

    GetKeyValueArrays(Allocator)

    Declaration
    public NativeKeyValueArrays<TKey, TValue> GetKeyValueArrays(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator
    Returns
    Type Description
    NativeKeyValueArrays<TKey, TValue>

    GetValueArray(Allocator)

    Declaration
    public NativeArray<TValue> GetValueArray(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator
    Returns
    Type Description
    NativeArray<TValue>

    GetValuesForKey(TKey)

    Declaration
    public NativeMultiHashMap<TKey, TValue>.Enumerator GetValuesForKey(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    NativeMultiHashMap.Enumerator<>

    Remove(TKey)

    Removes all elements with the specified key from the container.

    Declaration
    public int Remove(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key of the element to remove.

    Returns
    Type Description
    Int32

    Returns number of removed items.

    Remove(NativeMultiHashMapIterator<TKey>)

    Declaration
    public void Remove(NativeMultiHashMapIterator<TKey> it)
    Parameters
    Type Name Description
    NativeMultiHashMapIterator<TKey> it

    Remove<TValueEQ>(TKey, TValueEQ)

    Removes all elements with the specified key from the container.

    Declaration
    public void Remove<TValueEQ>(TKey key, TValueEQ value)
        where TValueEQ : struct, IEquatable<TValueEQ>
    Parameters
    Type Name Description
    TKey key

    The key of the element to remove.

    TValueEQ value
    Type Parameters
    Name Description
    TValueEQ

    SetValue(TValue, NativeMultiHashMapIterator<TKey>)

    Declaration
    public bool SetValue(TValue item, NativeMultiHashMapIterator<TKey> it)
    Parameters
    Type Name Description
    TValue item
    NativeMultiHashMapIterator<TKey> it
    Returns
    Type Description
    Boolean

    TryGetFirstValue(TKey, out TValue, out NativeMultiHashMapIterator<TKey>)

    Declaration
    public bool TryGetFirstValue(TKey key, out TValue item, out NativeMultiHashMapIterator<TKey> it)
    Parameters
    Type Name Description
    TKey key
    TValue item
    NativeMultiHashMapIterator<TKey> it
    Returns
    Type Description
    Boolean

    TryGetNextValue(out TValue, ref NativeMultiHashMapIterator<TKey>)

    Declaration
    public bool TryGetNextValue(out TValue item, ref NativeMultiHashMapIterator<TKey> it)
    Parameters
    Type Name Description
    TValue item
    NativeMultiHashMapIterator<TKey> it
    Returns
    Type Description
    Boolean

    Extension Methods

    JobNativeMultiHashMapVisitKeyValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobNativeMultiHashMapVisitKeyMutableValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobUnsafeMultiHashMapVisitKeyValue.Schedule<TJob, TKey, TValue>(TJob, UnsafeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobUnsafeMultiHashMapVisitKeyMutableValue.Schedule<TJob, TKey, TValue>(TJob, UnsafeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    In This Article
    • Constructors
      • NativeMultiHashMap(Int32, Allocator)
    • Properties
      • Capacity
      • IsCreated
      • Length
    • Methods
      • Add(TKey, TValue)
      • AsParallelWriter()
      • Clear()
      • ContainsKey(TKey)
      • CountValuesForKey(TKey)
      • Dispose()
      • Dispose(JobHandle)
      • GetKeyArray(Allocator)
      • GetKeyValueArrays(Allocator)
      • GetValueArray(Allocator)
      • GetValuesForKey(TKey)
      • Remove(TKey)
      • Remove(NativeMultiHashMapIterator<TKey>)
      • Remove<TValueEQ>(TKey, TValueEQ)
      • SetValue(TValue, NativeMultiHashMapIterator<TKey>)
      • TryGetFirstValue(TKey, out TValue, out NativeMultiHashMapIterator<TKey>)
      • TryGetNextValue(out TValue, ref NativeMultiHashMapIterator<TKey>)
    • Extension Methods
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023