Class ImmutableMultiTournaments.Builder<T extends Comparable<T>>
java.lang.Object
net.bmahe.genetics4j.core.spec.selection.ImmutableMultiTournaments.Builder<T>
- Enclosing class:
ImmutableMultiTournaments<T extends Comparable<T>>
Builds instances of type
MultiTournaments
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAllTournaments
(Iterable<? extends Tournament<T>> elements) Adds elements totournaments
list.addTournaments
(Tournament<T> element) Adds one element totournaments
list.addTournaments
(Tournament<T>... elements) Adds elements totournaments
list.build()
Builds a newMultiTournaments
.from
(MultiTournaments<T> instance) Fill a builder with attribute values from the providedMultiTournaments
instance.tournaments
(Iterable<? extends Tournament<T>> elements) Sets or replaces all elements fortournaments
list.
-
Field Details
-
tournaments
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedMultiTournaments
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
addTournaments
Adds one element totournaments
list.- Parameters:
element
- A tournaments element- Returns:
this
builder for use in a chained invocation
-
addTournaments
@SafeVarargs public final ImmutableMultiTournaments.Builder<T> addTournaments(Tournament<T>... elements) Adds elements totournaments
list.- Parameters:
elements
- An array of tournaments elements- Returns:
this
builder for use in a chained invocation
-
tournaments
public final ImmutableMultiTournaments.Builder<T> tournaments(Iterable<? extends Tournament<T>> elements) Sets or replaces all elements fortournaments
list.- Parameters:
elements
- An iterable of tournaments elements- Returns:
this
builder for use in a chained invocation
-
addAllTournaments
public final ImmutableMultiTournaments.Builder<T> addAllTournaments(Iterable<? extends Tournament<T>> elements) Adds elements totournaments
list.- Parameters:
elements
- An iterable of tournaments elements- Returns:
this
builder for use in a chained invocation
-
build
Builds a newMultiTournaments
.- Returns:
- An immutable instance of MultiTournaments
- Throws:
IllegalStateException
- if any required attributes are missing
-