This example will generate a sequential list of numbers from 20 to 30 using java 8 and guava.
Java 8
Using the IntStream.rangeClosed we will create a range of numbers between 20 and 30.
Note: You can also create a range using the LongStream.range.
Output
Google Guava
Using Guava ContiguousSet class, you can create a set of values by passing in a specified Range of numbers.
Output