@Immutable public class Sequences extends Object
| Constructor and Description |
|---|
Sequences() |
| Modifier and Type | Method and Description |
|---|---|
static Iterable<Integer> |
infiniteIntegers()
Create an iterator over an infinite number of monotonically increasing numbers starting at 0, useful when performing an
operation an unknown number of times.
|
static Iterable<Integer> |
infiniteIntegers(int startingAt)
Create an iterator over an infinite number monotonically increasing numbers starting at the given number, useful when
performing an operation an unknown number of times.
|
static <T> Supplier<T> |
randomlySelect(T... values)
Obtain a supplier function that randomly selects from the given values.
|
static <T> Supplier<T> |
randomlySelect(T first,
T... additional)
Obtain a supplier function that randomly selects from the given values.
|
static IntStream |
times(int number)
Create a stream of number monotonically increasing numbers starting at 0, useful when performing an operation
number times.
|
public static IntStream times(int number)
number - the number of values to include in the stream; must be positivepublic static Iterable<Integer> infiniteIntegers()
public static Iterable<Integer> infiniteIntegers(int startingAt)
startingAt - the first number to include in the resulting stream@SafeVarargs public static <T> Supplier<T> randomlySelect(T first, T... additional)
first - the first value that may be randomly pickedadditional - the additional values to randomly pick from; may be null or empty@SafeVarargs public static <T> Supplier<T> randomlySelect(T... values)
values - the values to randomly pick from; may not be null, should not be emptyCopyright © 2018 JBoss by Red Hat. All rights reserved.