Struct UnsafeParallelMultiHashMap<TKey, TValue>.ReadOnly
A read-only alias for the value of a UnsafeParallelHashMap. Does not have its own allocated storage.
Namespace: Unity.Collections.LowLevel.Unsafe
Assembly: Unity.Collections.dll
Syntax
public struct UnsafeParallelMultiHashMap<TKey, TValue>.ReadOnly
Properties
Capacity
The number of key-value pairs that fit in the current allocation.
Declaration
public readonly int Capacity { get; }
Property Value
Type | Description |
---|---|
int | The number of key-value pairs that fit in the current allocation. |
IsCreated
Whether this hash map has been allocated (and not yet deallocated).
Declaration
public readonly bool IsCreated { get; }
Property Value
Type | Description |
---|---|
bool | True if this hash map has been allocated (and not yet deallocated). |
IsEmpty
Whether this hash map is empty.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool | True if this hash map is empty or if the map has not been constructed. |
Methods
ContainsKey(TKey)
Returns true if a given key is present in this hash map.
Declaration
public readonly bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to look up. |
Returns
Type | Description |
---|---|
bool | True if the key was present. |
Count()
The current number of key-value pairs in this hash map.
Declaration
public readonly int Count()
Returns
Type | Description |
---|---|
int | The current number of key-value pairs in this hash map. |
GetEnumerator()
Returns an enumerator over the key-value pairs of this hash map.
Declaration
public UnsafeParallelMultiHashMap<TKey, TValue>.KeyValueEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
UnsafeParallelMultiHashMap<TKey, TValue>.KeyValueEnumerator | An enumerator over the key-value pairs of this hash map. |
Remarks
A key with N values is visited by the enumerator N times.
GetKeyArray(AllocatorHandle)
Returns an array with a copy of all this hash map's keys (in no particular order).
Declaration
public readonly NativeArray<TKey> GetKeyArray(AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | allocator | The allocator to use. |
Returns
Type | Description |
---|---|
NativeArray<TKey> | An array with a copy of all this hash map's keys (in no particular order). |
GetKeyValueArrays(AllocatorHandle)
Returns a NativeKeyValueArrays with a copy of all this hash map's keys and values.
Declaration
public readonly NativeKeyValueArrays<TKey, TValue> GetKeyValueArrays(AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | allocator | The allocator to use. |
Returns
Type | Description |
---|---|
NativeKeyValueArrays<TKey, TValue> | A NativeKeyValueArrays with a copy of all this hash map's keys and values. |
Remarks
The key-value pairs are copied in no particular order. For all i
, Values[i]
will be the value associated with Keys[i]
.
GetValueArray(AllocatorHandle)
Returns an array with a copy of all this hash map's values (in no particular order).
Declaration
public readonly NativeArray<TValue> GetValueArray(AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | allocator | The allocator to use. |
Returns
Type | Description |
---|---|
NativeArray<TValue> | An array with a copy of all this hash map's values (in no particular order). |
TryGetFirstValue(TKey, out TValue, out NativeParallelMultiHashMapIterator<TKey>)
Gets an iterator for a key.
Declaration
public readonly bool TryGetFirstValue(TKey key, out TValue item, out NativeParallelMultiHashMapIterator<TKey> it)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key. |
TValue | item | Outputs the associated value represented by the iterator. |
NativeParallelMultiHashMapIterator<TKey> | it | Outputs an iterator. |
Returns
Type | Description |
---|---|
bool | True if the key was present. |
TryGetNextValue(out TValue, ref NativeParallelMultiHashMapIterator<TKey>)
Advances an iterator to the next value associated with its key.
Declaration
public readonly bool TryGetNextValue(out TValue item, ref NativeParallelMultiHashMapIterator<TKey> it)
Parameters
Type | Name | Description |
---|---|---|
TValue | item | Outputs the next value. |
NativeParallelMultiHashMapIterator<TKey> | it | A reference to the iterator to advance. |
Returns
Type | Description |
---|---|
bool | True if the key was present and had another value. |