Class RedBlackTree<TKey, TValue>
A red–black tree is a type of self-balancing binary search tree, a data structure used in computer science, typically to implement associative arrays.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.Windows.Diagrams.Core.dll
Syntax
public class RedBlackTree<TKey, TValue> : RedBlackTree<KeyValuePair<TKey, TValue>>, ISearchTree<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
TKey
The type of the key. |
TValue
The type of the value. |
Constructors
RedBlackTree()
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree()
RedBlackTree(IComparer<TKey>)
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree(IComparer<TKey> comparer)
Parameters
System.Collections.Generic.IComparer<TKey>
comparer
The comparer. |
RedBlackTree(Comparison<TKey>)
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree(Comparison<TKey> comparison)
Parameters
System.Comparison<TKey>
comparison
The comparison. |
Properties
Item[TKey]
Gets or sets the value with the specified key.
Declaration
public TValue this[TKey key] { get; set; }
Parameters
TKey
key
|
Property Value
TValue
The key of the item to set or get. |
Keys
Gets an System.Collections.Generic.ICollection<> containing the keys of the System.Collections.Generic.IDictionary<, >.
Declaration
public ICollection<TKey> Keys { get; }
Property Value
System.Collections.Generic.ICollection<TKey>
|
Values
Gets an System.Collections.Generic.ICollection<> containing the values in the System.Collections.Generic.IDictionary<, >.
Declaration
public ICollection<TValue> Values { get; }
Property Value
System.Collections.Generic.ICollection<TValue>
|
Methods
Add(TKey, TValue)
Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<, >.
Declaration
public void Add(TKey key, TValue value)
Parameters
TKey
key
The object to use as the key of the element to add. |
TValue
value
The object to use as the value of the element to add. |
Contains(KeyValuePair<TKey, TValue>)
Determines whether this tree contains the given item.
Declaration
public override bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
System.Collections.Generic.KeyValuePair<TKey, TValue>
item
The item. |
Returns
System.Boolean
|
Overrides
ContainsKey(TKey)
Determines whether the System.Collections.Generic.IDictionary<, > contains an element with the specified key.
Declaration
public bool ContainsKey(TKey key)
Parameters
TKey
key
The key to locate in the System.Collections.Generic.IDictionary<, >. |
Returns
System.Boolean
True if the System.Collections.Generic.IDictionary<, > contains an element with the key; otherwise, false. |
Exceptions
System.ArgumentNullException
|
Remove(TKey)
Removes the element with the specified key from the System.Collections.Generic.IDictionary<, >.
Declaration
public bool Remove(TKey key)
Parameters
TKey
key
The key of the element to remove. |
Returns
System.Boolean
True if the element is successfully removed; otherwise, false. This method also returns false if |
Exceptions
System.ArgumentNullException
|
System.NotSupportedException
The System.Collections.Generic.IDictionary<, > is read-only. |
TryGetValue(TKey, out TValue)
Attempts to the get value.
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
TKey
key
The key. |
TValue
value
The value. |
Returns
System.Boolean
|