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.void
Checks invariants of implementing class.clear()
Deletes all values.int
size()
Determines how many values will be in the collection if build() is called now.
-
Method Details
-
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 interfaceIDequeBuilder<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 interfaceIDequeBuilder<T>
-
add
Description copied from interface:IDequeBuilder
Adds the specified value to the values included in the collection when build() is called.- Specified by:
add
in interfaceIDequeBuilder<T>
- Returns:
- the builder (convenience for chaining multiple calls)
-
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 interfaceIDequeBuilder<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 interfaceInvariantCheckable
-