BTreeKeySelector

public enum BTreeKeySelector

When the tree contains multiple elements with the same key, you can use a key selector to specify which matching element you want to work with.

  • Look for the first element that matches the key.

    Insertions with .first insert the new element before existing matches. Removals remove the first matching element.

    Declaration

    Swift

    case first
  • Look for the last element that matches the key.

    Insertions with .last insert the new element after existing matches. Removals remove the last matching element.

    Declaration

    Swift

    case last
  • Look for the first element that has a greater key.

    For insertions and removals, this works the same as .last.

    Declaration

    Swift

    case after
  • any

    Accept any element that matches the key. This can be faster when there are lots of duplicate keys: the search may stop before reaching a leaf node.

    (This may also happen for distinct keys, but since the vast majority of elements are stored in leaf nodes, its effect is not very significant.)

    Declaration

    Swift

    case any