Package org.stubit.random
Class RandomChoice.Builder<T>
java.lang.Object
org.stubit.random.RandomChoice.Builder<T>
- Enclosing class:
- RandomChoice
Randomly selects an element from a collection of choices.
-
Method Summary
Modifier and TypeMethodDescriptionand(Collection<T> additionalChoices) Add the provided additional choices to the selectionfinal RandomChoice.Builder<T>Add the provided additional choices to the selectionbuild()Returns a randomly selected element from thechoices.butNot(Collection<T> excluded) Excludes the provided choices from the selectionfinal RandomChoice.Builder<T>Excludes the provided choices from the selection
-
Method Details
-
and
Add the provided additional choices to the selection- Parameters:
additionalChoices- the additional choices
-
and
Add the provided additional choices to the selection- Parameters:
additionalChoices- the additional choices
-
butNot
Excludes the provided choices from the selection- Parameters:
excluded- the excluded choices- Returns:
- this
- Throws:
IllegalArgumentException- if no choices remain
-
butNot
Excludes the provided choices from the selection- Parameters:
excluded- the excluded choices- Returns:
- this
- Throws:
IllegalArgumentException- if no choices remain
-
build
Returns a randomly selected element from thechoices.- Returns:
- a randomly selected element form the
choices
-