/// <summary> /// Returns the iterator pointing to the first item greater than <paramref name="item"/>. /// </summary> public RedBlackTreeIterator <T> UpperBound(T item) { RedBlackTreeIterator <T> it = LowerBound(item); while (it.IsValid && host.Compare(it.Current, item) == 0) { it.MoveNext(); } return(it); }
/// <summary> /// Returns the iterator pointing to the specified item, or an iterator in End state if the item is not found. /// </summary> public RedBlackTreeIterator <T> Find(T item) { RedBlackTreeIterator <T> it = LowerBound(item); while (it.IsValid && host.Compare(it.Current, item) == 0) { if (host.Equals(it.Current, item)) { return(it); } it.MoveNext(); } return(default(RedBlackTreeIterator <T>)); }