Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


NativeParallelMultiHashMap<TKey, TValue>

An unordered, expandable associative array. Each key can have more than one associated value.
Read time 2 minutesLast updated 12 days ago

Definition

public struct NativeParallelMultiHashMap<TKey, TValue> : INativeDisposable, IDisposable, IEnumerable<KeyValue<TKey, TValue>>, IEnumerable where TKey : unmanaged, IEquatable<TKey> where TValue : unmanaged

Remarks

Unlike a regular NativeParallelHashMap, a NativeParallelMultiHashMap can store multiple key-value pairs with the same key.
The keys are not deduplicated: two key-value pairs with the same key are stored as fully separate key-value pairs.

Static Fields

Value

Description

MaxCapacityThe maximum number of elements this type of container can hold.

Constructors

Constructor

Description

NativeParallelMultiHashMap`2(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle)Returns a newly allocated multi hash map.

Properties

Property

Description

CapacityReturns the number of key-value pairs that fit in the current allocation.
IsCreatedWhether this hash map has been allocated (and not yet deallocated).
IsEmptyWhether this hash map is empty.

Methods

Method

Description

AddAdds a new key-value pair.
AsParallelWriterReturns a parallel writer for this hash map.
AsReadOnlyReturns a readonly version of this NativeParallelHashMap instance.
ClearRemoves all key-value pairs.
ContainsKeyReturns true if a given key is present in this hash map.
CountReturns the current number of key-value pairs in this hash map.
CountValuesForKeyReturns the number of values associated with a given key.
DisposeReleases all resources (memory and safety handles).
GetEnumeratorReturns an enumerator over the key-value pairs of this hash map.
GetKeyArrayReturns an array with a copy of all the keys (in no particular order).
GetKeyValueArraysReturns a NativeKeyValueArrays with a copy of all the keys and values (in no particular order).
GetValueArrayReturns an array with a copy of all the values (in no particular order).
GetValuesForKeyReturns an enumerator over the values of an individual key.
RemoveRemoves a key and its associated value(s).
SetValueSets a new value for an existing key-value pair.
TryGetFirstValueGets an iterator for a key.
TryGetNextValueAdvances an iterator to the next value associated with its key.

Structs

Struct

Description

NativeParallelMultiHashMap<TKey, TValue>.EnumeratorAn enumerator over the values of an individual key in a multi hash map.
NativeParallelMultiHashMap<TKey, TValue>.KeyValueEnumeratorAn enumerator over the key-value pairs of a multi hash map.
NativeParallelMultiHashMap<TKey, TValue>.ParallelWriterA parallel writer for a NativeParallelMultiHashMap.
NativeParallelMultiHashMap<TKey, TValue>.ReadOnlyA read-only alias for the value of a NativeParallelHashMap. Does not have its own allocated storage.