Class FingerTreeBuilder<E>

  • Type Parameters:
    E - element type
    All Implemented Interfaces:
    Iterable<E>

    public final class FingerTreeBuilder<E>
    extends Object
    implements Iterable<E>
    A builder for FingerTrees from leaf nodes.
    Author:
    BaseX Team 2005-22, BSD License, Leo Woerteler
    • Constructor Detail

      • FingerTreeBuilder

        public FingerTreeBuilder()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Checks if this builder is empty, i.e. if no leaf nodes were added to it.
        Returns:
        true if the builder is empty, false otherwise
      • prepend

        public void prepend​(Node<E,​E> leaf)
        Adds a leaf node to the front of the tree.
        Parameters:
        leaf - the leaf node to add
      • append

        public void append​(Node<E,​E> leaf)
        Adds a leaf node to the back of the tree.
        Parameters:
        leaf - the leaf node to add
      • append

        public void append​(FingerTree<E,​E> tree)
        Appends another finger tree to this builder.
        Parameters:
        tree - finger tree to append
      • freeze

        public FingerTree<E,​E> freeze()
        Builds a finger tree from the current state of this builder.
        Returns:
        the resulting finger tree