Home  >  Forum  >  Core Java
Post New Query

Difference between IntStream.rangeClosed() and IntStream.range() in Java 8


joined on
November 02,2014
Asked on December 31,2014
Hi,

What is difference between IntStream.rangeClosed() and IntStream.range() in Java 8.

Regards
Paramjeet


joined on
December 28,2013
Replied on December 31,2014

IntStream.rangeClosed() and IntStream.range() both generates incremental number by one from start to end point in java 8.

IntStream.rangeClosed(2,6) works as >= and  <=  and  produces 

2,3,4,5,6

IntStream.range(2,6) works as >= and  < and  produces same but does not include the last number 

2,3,4,5

Find the link for the sample example.




 

Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us