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 Summary
Modifier and TypeMethodDescriptionAdds the specified value to the values included in the collection when build() is called.build()Builds and returns a collection containing all of the added values.voidChecks invariants of implementing class.clear()Deletes all values.intsize()Determines how many values will be in the collection if build() is called now.
-
Method Details
-
build
Description copied from interface:IDequeBuilderBuilds 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:
buildin interfaceIDequeBuilder<T>- Returns:
- the collection
-
size
public int size()Description copied from interface:IDequeBuilderDetermines how many values will be in the collection if build() is called now.- Specified by:
sizein interfaceIDequeBuilder<T>
-
add
Description copied from interface:IDequeBuilderAdds the specified value to the values included in the collection when build() is called.- Specified by:
addin interfaceIDequeBuilder<T>- Returns:
- the builder (convenience for chaining multiple calls)
-
clear
Description copied from interface:IDequeBuilderDeletes all values. This is useful to reset to build a new list with the same builder.- Specified by:
clearin interfaceIDequeBuilder<T>- Returns:
- the builder (convenience for chaining multiple calls)
-
checkInvariants
public void checkInvariants()Description copied from interface:InvariantCheckableChecks invariants of implementing class.- Specified by:
checkInvariantsin interfaceInvariantCheckable
-