docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NativeParallelHashSet<T>

    An unordered, expandable set of unique values.

    Implements
    INativeDisposable
    Namespace: Unity.Collections
    Assembly: Unity.Collections.dll
    Syntax
    public struct NativeParallelHashSet<T> : INativeDisposable where T : unmanaged, IEquatable<T>
    Type Parameters
    Name Description
    T

    The type of the values.

    Constructors

    NativeParallelHashSet(int, AllocatorHandle)

    Initializes and returns an instance of NativeHashSet.

    Declaration
    public NativeParallelHashSet(int capacity, AllocatorManager.AllocatorHandle allocator)
    Parameters
    Type Name Description
    int capacity

    The number of values that should fit in the initial allocation.

    AllocatorManager.AllocatorHandle allocator

    The allocator to use.

    Properties

    Capacity

    The number of values that fit in the current allocation.

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

    The number of values that fit in the current allocation.

    Exceptions
    Type Condition
    Exception

    Thrown if value is less than the current capacity.

    IsCreated

    Whether this set has been allocated (and not yet deallocated).

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

    True if this set has been allocated (and not yet deallocated).

    IsEmpty

    Whether this set is empty.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    True if this set is empty or if the set has not been constructed.

    Methods

    Add(T)

    Adds a new value (unless it is already present).

    Declaration
    public bool Add(T item)
    Parameters
    Type Name Description
    T item

    The value to add.

    Returns
    Type Description
    bool

    True if the value was not already present.

    AsParallelWriter()

    Returns a parallel writer.

    Declaration
    public NativeParallelHashSet<T>.ParallelWriter AsParallelWriter()
    Returns
    Type Description
    NativeParallelHashSet<T>.ParallelWriter

    A parallel writer.

    Clear()

    Removes all values.

    Declaration
    public void Clear()
    Remarks

    Does not change the capacity.

    Contains(T)

    Returns true if a particular value is present.

    Declaration
    public bool Contains(T item)
    Parameters
    Type Name Description
    T item

    The value to check for.

    Returns
    Type Description
    bool

    True if the value was present.

    Count()

    Returns the current number of values in this set.

    Declaration
    public int Count()
    Returns
    Type Description
    int

    The current number of values in this set.

    Dispose()

    Releases all resources (memory and safety handles).

    Declaration
    public void Dispose()

    Dispose(JobHandle)

    Creates and schedules a job that will dispose this set.

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

    A job handle. The newly scheduled job will depend upon this handle.

    Returns
    Type Description
    JobHandle

    The handle of a new job that will dispose this set.

    GetEnumerator()

    Returns an enumerator over the values of this set.

    Declaration
    public NativeParallelHashSet<T>.Enumerator GetEnumerator()
    Returns
    Type Description
    NativeParallelHashSet<T>.Enumerator

    An enumerator over the values of this set.

    Remove(T)

    Removes a particular value.

    Declaration
    public bool Remove(T item)
    Parameters
    Type Name Description
    T item

    The value to remove.

    Returns
    Type Description
    bool

    True if the value was present.

    ToNativeArray(AllocatorHandle)

    Returns an array with a copy of this set's values (in no particular order).

    Declaration
    public NativeArray<T> ToNativeArray(AllocatorManager.AllocatorHandle allocator)
    Parameters
    Type Name Description
    AllocatorManager.AllocatorHandle allocator

    The allocator to use.

    Returns
    Type Description
    NativeArray<T>

    An array with a copy of the set's values.

    Implements

    INativeDisposable

    Extension Methods

    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, FixedList128Bytes<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, FixedList32Bytes<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, FixedList4096Bytes<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, FixedList512Bytes<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, FixedList64Bytes<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, NativeArray<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, NativeList<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, NativeParallelHashSet<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, FixedList128Bytes<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, FixedList32Bytes<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, FixedList4096Bytes<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, FixedList512Bytes<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, FixedList64Bytes<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, NativeArray<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, NativeList<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, NativeParallelHashSet<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, FixedList128Bytes<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, FixedList32Bytes<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, FixedList4096Bytes<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, FixedList512Bytes<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, FixedList64Bytes<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, NativeArray<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, NativeList<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, NativeParallelHashSet<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, UnsafeList<T>)
    HashSetExtensions.ExceptWith<T>(NativeParallelHashSet<T>, UnsafeParallelHashSet<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, UnsafeList<T>)
    HashSetExtensions.IntersectWith<T>(NativeParallelHashSet<T>, UnsafeParallelHashSet<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, UnsafeList<T>)
    HashSetExtensions.UnionWith<T>(NativeParallelHashSet<T>, UnsafeParallelHashSet<T>)
    Extensions.ToArray<T>(NativeParallelHashSet<T>)

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Constructors
      • NativeParallelHashSet(int, AllocatorHandle)
    • Properties
      • Capacity
      • IsCreated
      • IsEmpty
    • Methods
      • Add(T)
      • AsParallelWriter()
      • Clear()
      • Contains(T)
      • Count()
      • Dispose()
      • Dispose(JobHandle)
      • GetEnumerator()
      • Remove(T)
      • ToNativeArray(AllocatorHandle)
    • Implements
    • Extension Methods
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)