Typeberry by Fluffy Labs - v0.4.0
    Preparing search index...

    Class SortedArray<V>

    Collection of elements of type V that has some strict ordering.

    The items are stored sorted, which allows logarithmic insertion & lookup and obviously in-order iteration.

    Duplicates are allowed, so make sure to check presence before inserting.

    Type Parameters

    • V

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    array: V[]
    comparator: Comparator<V>

    Accessors

    Methods

    • Return the exact (in terms of comparator) element that's in the array if present.

      Note this API might look redundant on a first glance, but it really depends on the comparator. We might have a complex object inside the array, yet the comparator will consider two objects equal just by looking at the id. With this API we are able to retrieve the exact object that's stored.

      Parameters

      Returns V | undefined