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. |
Implements
Keys
Gets an System.Collections.Generic.ICollection<T> containing the keys of the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
public ICollection<TKey> Keys { get; }
Property Value
System.Collections.Generic.ICollection<TKey>
|
Implements
Values
Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
public ICollection<TValue> Values { get; }
Property Value
System.Collections.Generic.ICollection<TValue>
|
Implements
Methods
Add(TKey, TValue)
Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>.
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. |
Implements
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
Implements
ContainsKey(TKey)
Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> 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<TKey, TValue>. |
Returns
System.Boolean
True if the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the key; otherwise, false. |
Implements
Exceptions
System.ArgumentNullException
|
Remove(TKey)
Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>.
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 |
Implements
Exceptions
System.ArgumentNullException
|
System.NotSupportedException
The System.Collections.Generic.IDictionary<TKey, TValue> 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
|