Package io.debezium.util
Class Sequences
java.lang.Object
io.debezium.util.Sequences
Utility methods for obtaining streams of integers.
- Author:
- Randall Hauch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate an iterator over an infinite number of monotonically increasing numbers starting at 0, useful when performing an operation an unknown number of times.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.
-
Constructor Details
-
Sequences
public Sequences()
-
-
Method Details
-
times
Create a stream of number monotonically increasing numbers starting at 0, useful when performing an operation number times.- Parameters:
number
- the number of values to include in the stream; must be positive- Returns:
- the sequence; never null
-
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.- Returns:
- the sequence; never null
-
infiniteIntegers
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.- Parameters:
startingAt
- the first number to include in the resulting stream- Returns:
- the sequence; never null
-
randomlySelect
Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then the resulting supplier function may return null values.- Parameters:
first
- the first value that may be randomly pickedadditional
- the additional values to randomly pick from; may be null or empty- Returns:
- the supplier function; never null
-
randomlySelect
Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then the resulting supplier function may return null values.- Parameters:
values
- the values to randomly pick from; may not be null, should not be empty- Returns:
- the supplier function; never null
-