ClassRedBlackTree<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.
Definition
Namespace:Telerik.Windows.Diagrams.Core
Assembly:Telerik.Windows.Diagrams.Core.dll
Type Parameters:
TKey
The type of the key.
TValue
The type of the value.
Syntax:
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
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
Inheritance: objectBinarySearchTreeBase<KeyValuePair<TKey, TValue>>RedBlackTree<KeyValuePair<TKey, TValue>>RedBlackTree<TKey, TValue>
Implements:
Inherited Members
Constructors
RedBlackTree()
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree()
RedBlackTree(Comparison<TKey>)
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree(Comparison<TKey> comparison)
Parameters
comparison
Comparison<TKey>
The comparison.
RedBlackTree(IComparer<TKey>)
Initializes a new instance of the RedBlackTree<TKey, TValue> class.
Declaration
public RedBlackTree(IComparer<TKey> comparer)
Parameters
comparer
IComparer<TKey>
The comparer.
Properties
Keys
Gets an ICollection<T> containing the keys of the IDictionary<TKey, TValue>.
Declaration
public ICollection<TKey> Keys { get; }
Property Value
ICollection<TKey>
Implements
Values
Gets an ICollection<T> containing the values in the IDictionary<TKey, TValue>.
Declaration
public ICollection<TValue> Values { get; }
Property Value
ICollection<TValue>
Implements
this[TKey]
Gets or sets the value with the specified key.
Declaration
public TValue this[TKey key] { get; set; }
Parameters
key
TKey
Property Value
TValue
The key of the item to set or get.
Implements
Methods
Add(TKey, TValue)
Adds an element with the provided key and value to the IDictionary<TKey, TValue>.
Declaration
public void Add(TKey key, TValue value)
Parameters
key
TKey
The object to use as the key of the element to add.
value
TValue
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
item
KeyValuePair<TKey, TValue>
The item.
Returns
true if the item is in this tree; otherwise, false.
Overrides
Implements
ContainsKey(TKey)
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
Declaration
public bool ContainsKey(TKey key)
Parameters
key
TKey
The key to locate in the IDictionary<TKey, TValue>.
Returns
True if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false.
Exceptions
key is null.
Implements
Remove(TKey)
Removes the element with the specified key from the IDictionary<TKey, TValue>.
Declaration
public bool Remove(TKey key)
Parameters
key
TKey
The key of the element to remove.
Returns
True if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original IDictionary<TKey, TValue>.
Exceptions
key is null.
The IDictionary<TKey, TValue> is read-only.
Implements
TryGetValue(TKey, out TValue)
Attempts to the get value.
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
key
TKey
The key.
value
TValue
The value.
Returns
Implements