I would like to do the following:
List list = IntStream.range(0, 7).collect(Collectors.toList());
but in a way that the resu
FYI, there's a reasonable way to do this in Guava without Java 8:
ImmutableSortedSet set = ContiguousSet.create(
Range.closedOpen(0, 7), DiscreteDomain.integers());
ImmutableList list = set.asList();
If you don't actually need the List semantics and can just use a NavigableSet, that's even better since a ContiguousSet doesn't have to actually store all the elements in it (just the Range and DiscreteDomain).