In [1]: range(-100, 100, 20)
Out[1]: [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80]
What's the easiest way to create Array
like above using standard libraries of Java instead of writting own function?
There is IntStream.range(-100, 100)
, but step is hardcoded to 1.
THIS IS NOT A DUPLICATE of Java: Equivalent of Python's range(int, int)?, because I need a step
(offset) between numbers and want to use java built-in libraries instead of 3rd-party libraries. I've checked that question and answers before adding my own. The difference is subtle but essential.