Class ArrayDeque.Builder<T>

java.lang.Object
org.javimmutable.collections.deque.ArrayDeque.Builder<T>
All Implemented Interfaces:
IDequeBuilder<T>, InvariantCheckable
Enclosing class:
ArrayDeque<T>

public static class ArrayDeque.Builder<T> extends Object implements IDequeBuilder<T>, InvariantCheckable
  • Method Details

    • build

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

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

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

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

      public void checkInvariants()
      Description copied from interface: InvariantCheckable
      Checks invariants of implementing class.
      Specified by:
      checkInvariants in interface InvariantCheckable