Class TreeList.ListBuilder<T>

java.lang.Object
org.javimmutable.collections.list.TreeList.ListBuilder<T>
All Implemented Interfaces:
IListBuilder<T>
Enclosing class:
TreeList<T>

@ThreadSafe public static class TreeList.ListBuilder<T> extends Object implements IListBuilder<T>
  • Constructor Details

    • ListBuilder

      public ListBuilder()
  • Method Details

    • build

      @Nonnull public TreeList<T> build()
      Description copied from interface: IListBuilder
      Builds and returns a collection containing all of the added values. May be called as often as desired and is safe to call and then continue adding more elements to build another collection with those additional elements.
      Specified by:
      build in interface IListBuilder<T>
      Returns:
      the collection
    • combineWith

    • size

      public int size()
      Description copied from interface: IListBuilder
      Determines how many values will be in the collection if build() is called now.
      Specified by:
      size in interface IListBuilder<T>
    • add

      @Nonnull public TreeList.ListBuilder<T> add(T value)
      Description copied from interface: IListBuilder
      Adds the specified value to the values included in the collection when build() is called.
      Specified by:
      add in interface IListBuilder<T>
      Returns:
      the builder (convenience for chaining multiple calls)
    • addAll

      @Nonnull public TreeList.ListBuilder<T> addAll(Iterator<? extends T> source)
      Description copied from interface: IListBuilder
      Adds all values in the Iterator to the values included in the collection when build() is called.
      Specified by:
      addAll in interface IListBuilder<T>
      Parameters:
      source - Iterator containing values to add
      Returns:
      the builder (convenience for chaining multiple calls)
    • addAll

      @Nonnull public TreeList.ListBuilder<T> addAll(Iterable<? extends T> source)
      Description copied from interface: IListBuilder
      Adds all values in the Collection to the values included in the collection when build() is called.
      Specified by:
      addAll in interface IListBuilder<T>
      Parameters:
      source - Collection containing values to add
      Returns:
      the builder (convenience for chaining multiple calls)
    • addAll

      @Nonnull public <K extends T> TreeList.ListBuilder<T> addAll(K... source)
      Description copied from interface: IListBuilder
      Adds all values in the array to the values included in the collection when build() is called.
      Specified by:
      addAll in interface IListBuilder<T>
      Parameters:
      source - array containing values to add
      Returns:
      the builder (convenience for chaining multiple calls)
    • addAll

      @Nonnull public TreeList.ListBuilder<T> addAll(Indexed<? extends T> source, int offset, int limit)
      Description copied from interface: IListBuilder
      Adds all values in the specified range of Indexed to the values included in the collection when build() is called.
      Specified by:
      addAll in interface IListBuilder<T>
      Parameters:
      source - Indexed containing values to add
      Returns:
      the builder (convenience for chaining multiple calls)
    • addAll

      @Nonnull public TreeList.ListBuilder<T> addAll(Indexed<? extends T> source)
      Description copied from interface: IListBuilder
      Adds all values in the Indexed to the values included in the collection when build() is called.
      Specified by:
      addAll in interface IListBuilder<T>
      Parameters:
      source - Indexed containing values to add
      Returns:
      the builder (convenience for chaining multiple calls)
    • clear

      @Nonnull public TreeList.ListBuilder<T> clear()
      Description copied from interface: IListBuilder
      Deletes all values. This is useful to reset to build a new list with the same builder.
      Specified by:
      clear in interface IListBuilder<T>
      Returns:
      the builder (convenience for chaining multiple calls)
    • checkInvariants

      public void checkInvariants()