Class TrieArray.Builder<T>

java.lang.Object
org.javimmutable.collections.array.TrieArray.Builder<T>
All Implemented Interfaces:
IArrayBuilder<T>
Enclosing class:
TrieArray<T>

@ThreadSafe public static class TrieArray.Builder<T> extends Object implements IArrayBuilder<T>
  • Method Details

    • size

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

      @Nonnull public IArrayBuilder<T> clear()
      Description copied from interface: IArrayBuilder
      Removes all objects and resets the builder to it's initial post-build state.
      Specified by:
      clear in interface IArrayBuilder<T>
      Returns:
      the builder (convenience for chaining multiple calls)
    • add

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

      @Nonnull public IArrayBuilder<T> put(int index, T value)
      Description copied from interface: IArrayBuilder
      Adds the specified value to the values included in the collection when build() is called.
      Specified by:
      put in interface IArrayBuilder<T>
      Returns:
      the builder (convenience for chaining multiple calls)
    • setNextIndex

      public IArrayBuilder<T> setNextIndex(int index)
      Description copied from interface: IArrayBuilder
      Sets the index at which next call to add() will insert the value.
      Specified by:
      setNextIndex in interface IArrayBuilder<T>
    • build

      @Nonnull public IArray<T> build()
      Description copied from interface: IArrayBuilder
      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 IArrayBuilder<T>
      Returns:
      the collection