public interface Suppliers
-
Method Summary
Static Methods
Builds a
Supplier which returns
null based on dice rolling.
Builds a
Supplier which returns
null based on dice rolling.
Builds a
Supplier which returns the default value based on dice
rolling.
-
Method Details
-
rollingSupplier
static <T> Supplier<T> rollingSupplier(Supplier<? extends T> baseSupplier,
int diceSides,
T defaultValue)
Builds a
Supplier which returns the default value based on dice
rolling.
The returned Supplier will return the defaultValue when the dice rolls to 1;
otherwise, it will return the value from the baseSupplier.
- Type Parameters:
T - The type of supplied value
- Parameters:
baseSupplier - The base Supplier to get value when the dice
roll is not 1
diceSides - The number of sides of dice
defaultValue - The default value to return when the dice roll is 1
- Returns:
- The built
Supplier
- See Also:
-
-
rollingSupplier
static <T> Supplier<T> rollingSupplier(Supplier<? extends T> baseSupplier,
int diceSides)
Builds a
Supplier which returns
null based on dice rolling.
The returned Supplier will return the null when the dice rolls to 1;
otherwise, it will return the value from the baseSupplier.
- Type Parameters:
T - The type of supplied value
- Parameters:
baseSupplier - The base Supplier to get value when the dice
roll is not 1
diceSides - The number of sides of dice
- Returns:
- The built
Supplier
- See Also:
-
-
rollingSupplier
Builds a
Supplier which returns
null based on dice rolling.
The number of sides of dice is 6 by default.
The returned Supplier will return the null when the dice rolls to 1;
otherwise, it will return the value from the baseSupplier.
- Type Parameters:
T - The type of supplied value
- Parameters:
baseSupplier - The base Supplier to get value when the dice
roll is not 1
- Returns:
- The built
Supplier
- See Also:
-
-
lazySupplier
Builds a
Supplier which initializes the target
Supplier lazily.
The returned Supplier will invoke the lazySupplier only once
to get the target Supplier. Subsequent invocations will use the
target Supplier directly.
- Type Parameters:
T - The type of supplied value
- Parameters:
lazySupplier - The supplier of target Supplier
- Returns:
- The built
Supplier