LongStream rangeClosed(long startInclusive, long endInclusive)
returns a sequential ordered LongStream from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step of 1.
rangeClosed
has the following syntax.
static LongStream rangeClosed(long startInclusive, long endInclusive)
The following example shows how to use rangeClosed
.
import java.util.stream.LongStream; public class Main { public static void main(String[] args) { LongStream b = LongStream.rangeClosed(1L, 5L); b.forEach(System.out::println); } }
The code above generates the following result.