Class GenericSetBuilder<T>

java.lang.Object
org.javimmutable.collections.common.GenericSetBuilder<T>
All Implemented Interfaces:
ISetBuilder<T>

public class GenericSetBuilder<T> extends Object implements ISetBuilder<T>
  • Constructor Details

  • Method Details

    • build

      @Nonnull public ISet<T> build()
      Description copied from interface: ISetBuilder
      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 ISetBuilder<T>
      Returns:
      the collection
    • clear

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

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

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