Class ParallelArrays<TKey, TValue>
- Namespace
- AlgorithmsSW.List
- Assembly
- AlgorithmsSW.dll
Represents a list of key-value pairs using two parallel arrays.
public class ParallelArrays<TKey, TValue>
Type Parameters
TKey
The type of keys in the list.
TValue
The type of values in the list.
- Inheritance
-
ParallelArrays<TKey, TValue>
- Inherited Members
- Extension Methods
Constructors
ParallelArrays(int)
Initializes a new instance of the ParallelArrays<TKey, TValue> class.
public ParallelArrays(int initialCapacity)
Parameters
initialCapacity
intThe initial number of key-value pairs this instance can support.
Properties
Capacity
Gets the capacity of this instance.
public int Capacity { get; }
Property Value
Count
Gets the number of key-value pairs this instance contains.
public int Count { get; }
Property Value
IsEmpty
Gets a value indicating whether this instance is empty.
public bool IsEmpty { get; }
Property Value
IsFull
Gets a value indicating whether this instance is full.
public bool IsFull { get; }
Property Value
Keys
Gets the keys of this instance.
public IReadonlyRandomAccessList<TKey> Keys { get; }
Property Value
Values
Gets the values of this instance.
public IReadonlyRandomAccessList<TValue> Values { get; }
Property Value
- IReadonlyRandomAccessList<TValue>
Methods
Add(TKey, TValue)
Adds a key-value pair to this instance.
public void Add(TKey key, TValue value)
Parameters
key
TKeyThe key to add.
value
TValueThe value associated with the key to add.
Clear()
Removes all key-value pairs from this instance.
public void Clear()
Copy()
Creates a copy of this instance.
public ParallelArrays<TKey, TValue> Copy()
Returns
- ParallelArrays<TKey, TValue>
DeleteAt(int)
Deletes the key-value pair at the specified index.
public void DeleteAt(int index)
Parameters
index
int
Get(int, out TKey, out TValue)
Gets the key-value pair at the specified index.
public void Get(int index, out TKey key, out TValue value)
Parameters
index
intThe index of the key-value pair to get.
key
TKeyThe key at the specified index.
value
TValueThe value at the specified index.
GetKey(int)
Gets the key at the specified index.
public TKey GetKey(int index)
Parameters
index
intThe index of the key to get.
Returns
- TKey
GetValue(int)
Gets the value at the specified index.
public TValue GetValue(int index)
Parameters
index
intThe index of the key to get.
Returns
- TValue
InsertAt(int, TKey, TValue)
Inserts a key-value pair at the specified index.
public void InsertAt(int index, TKey key, TValue value)
Parameters
index
intThe index at which to insert the key-value pair.
key
TKeyThe key to insert.
value
TValueThe value associated with the key to insert.
RemoveLast(int)
Removes the last n
key-value pairs from this instance.
public void RemoveLast(int n)
Parameters
n
intThe number of key-value pairs to remove.
RemoveLast(out TKey, out TValue)
Removes the last key-value pair from this instance.
public void RemoveLast(out TKey key, out TValue value)
Parameters
key
TKeyThe remove key.
value
TValueThe value associated with the removed key.
Set(int, TKey, TValue)
Sets the key-value pair at the specified index.
public void Set(int index, TKey key, TValue value)
Parameters
index
intThe index of the key-value pair to set.
key
TKeyThe key to set.
value
TValueThe value associated with the key to set.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.