interface OrderedSet<E is CanCompare<E>>
Interface OrderedSet<E>
defines the operations that a class must implement to be an ordered set. An ordered set is used to store elements of type E
. It should be possible to find elements quickly, allowing for efficient addition and retrieval. OrderedSet<E>
differs from Set<E>
in that elements must have some ordering defined by the CanCompare<E>
interface. Because of this ordering, OrderedSet<E>
is also able to define methods that manipulate ranges of element values.
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly |
(nullable E) |
ceiling(E element) Method should return the lowest-valued element whose value is greater than or equal to the given element. |
public readonly |
(nullable E) |
floor(E element) Method should return the highest-valued element whose value is less than or equal to the given element. |
public readonly |
(E) |
max() Method should return the highest-valued element in the ordered set or throw an exception if the ordered set is empty. |
public readonly |
(E) |
min() Method should return the lowest-valued element in the ordered set or throw an exception if the ordered set is empty. |
public readonly |
(CanIterate<E>) |
values(E low, E high) Method should return an iterable collection of all the elements in the ordered set whose values are in the inclusive range from the low element to the high element given. |
public readonly ceiling(E element) => (nullable E)
Method should return the lowest-valued element whose value is greater than or equal to the given element.
element
- element to find the floor of
ceiling of given element, or null
if no such element exists
public readonly floor(E element) => (nullable E)
Method should return the highest-valued element whose value is less than or equal to the given element.
element
- element to find the floor of
floor of given element, or null
if no such element exists
public readonly max() => (E)
Method should return the highest-valued element in the ordered set or throw an exception if the ordered set is empty.
highest element
public readonly min() => (E)
Method should return the lowest-valued element in the ordered set or throw an exception if the ordered set is empty.
lowest element
public readonly values(E low, E high) => (CanIterate<E>)
Method should return an iterable collection of all the elements in the ordered set whose values are in the inclusive range from the low element to the high element given.
low
- lowest element to include in the range
high
- highest element to include in the range
iterable collection of elements in the range