Class NativeHashMapExtensions | Collections | 0.15.0-preview.21
docs.unity3d.com
    Show / Hide Table of Contents

    Class NativeHashMapExtensions

    NativeHashMap extensions.

    Inheritance
    Object
    NativeHashMapExtensions
    Namespace: Unity.Collections
    Syntax
    public static class NativeHashMapExtensions

    Methods

    GetBucketData<TKey, TValue>(NativeHashMap<TKey, TValue>)

    Returns internal bucked data structure. Internal bucket structure is useful when creating custom jobs operating on container. Each bucket can be processed concurrently with other buckets, and all key/value pairs in each bucket must processed individually (in sequential order) by a single thread.

    Declaration
    public static UnsafeHashMapBucketData GetBucketData<TKey, TValue>(this NativeHashMap<TKey, TValue> container)
        where TKey : struct, IEquatable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeHashMap<TKey, TValue> container

    This container.

    Returns
    Type Description
    UnsafeHashMapBucketData

    Returns internal bucked data structure.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the container.

    TValue

    The type of the values in the container.

    GetUniqueKeyArray<TKey, TValue>(UnsafeMultiHashMap<TKey, TValue>, Allocator)

    Returns array populated with unique keys.

    Declaration
    public static (NativeArray<TKey>, int) GetUniqueKeyArray<TKey, TValue>(this UnsafeMultiHashMap<TKey, TValue> container, Allocator allocator)
        where TKey : struct, IEquatable<TKey>, IComparable<TKey> where TValue : struct
    Parameters
    Type Name Description
    UnsafeMultiHashMap<TKey, TValue> container

    This container.

    Allocator allocator

    A member of the Unity.Collections.Allocator enumeration.

    Returns
    Type Description
    ValueTuple<NativeArray<TKey>, Int32>

    Unique keys of the container.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the container.

    TValue

    The type of the values in the container.

    GetUniqueKeyArray<TKey, TValue>(NativeMultiHashMap<TKey, TValue>, Allocator)

    Returns array populated with unique keys.

    Declaration
    public static (NativeArray<TKey>, int) GetUniqueKeyArray<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container, Allocator allocator)
        where TKey : struct, IEquatable<TKey>, IComparable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    This container.

    Allocator allocator

    A member of the Unity.Collections.Allocator enumeration.

    Returns
    Type Description
    ValueTuple<NativeArray<TKey>, Int32>

    Unique keys of the container.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the container.

    TValue

    The type of the values in the container.

    GetUnsafeBucketData<TKey, TValue>(NativeMultiHashMap<TKey, TValue>)

    Returns internal bucked data structure. Internal bucket structure is useful when creating custom jobs operating on container. Each bucket can be processed concurrently with other buckets, and all key/value pairs in each bucket must processed individually (in sequential order) by a single thread.

    Declaration
    public static UnsafeHashMapBucketData GetUnsafeBucketData<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container)
        where TKey : struct, IEquatable<TKey> where TValue : struct
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    This container.

    Returns
    Type Description
    UnsafeHashMapBucketData

    Returns internal bucked data structure.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the container.

    TValue

    The type of the values in the container.

    Remove<TKey, TValue>(NativeMultiHashMap<TKey, TValue>, TKey, TValue)

    Removes all elements with the specified key from the container.

    Declaration
    public static void Remove<TKey, TValue>(this NativeMultiHashMap<TKey, TValue> container, TKey key, TValue value)
        where TKey : struct, IEquatable<TKey> where TValue : struct, IEquatable<TValue>
    Parameters
    Type Name Description
    NativeMultiHashMap<TKey, TValue> container

    This container.

    TKey key

    The key of the element to remove.

    TValue value

    The value of the element to remove.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the container.

    TValue

    The type of the values in the container.

    Unique<T>(NativeArray<T>)

    Eliminates duplicates from every consecutive group of equivalent elements.

    Declaration
    public static int Unique<T>(this NativeArray<T> array)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeArray<T> array

    Array to perform unique operation on.

    Returns
    Type Description
    Int32

    Number of unique elements in array.

    Type Parameters
    Name Description
    T

    The type of values in the array.

    Remarks

    Array should be sorted before running unique operation.

    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