What I would like to do is add values from 1 to 15 to the empty HashSet.
Set<Long> vipSeats = new HashSet<>();
Can I avoid using loop? Does Java have functional support for it e.g. stream ?
LongStream.rangeClosed(1, 15).boxed().collect(Collectors.toSet());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With