I would like to do the following:
List list = IntStream.range(0, 7).collect(Collectors.toList());
but in a way that the resu
BTW: since JDK 10 it can be done in pure Java:
List list = IntStream.range(0, 7) .collect(Collectors.toUnmodifiableList());
Also toUnmodifiableSet and toUnmodifiableMap available.
toUnmodifiableSet
toUnmodifiableMap
Inside collector it was done via List.of(list.toArray())
List.of(list.toArray())