Can the list returned by a Java streams collector be made unmodifiable? [duplicate]
问题 This question already has answers here : Creating an immutable list from an existing list using streams (2 answers) Closed 2 months ago . When working with Java streams, we can use a collector to produce a collection such as a stream. For example, here we make a stream of the Month enum objects, and for each one generate a String holding the localized name of the month. We collect the results into a List of type String by calling Collectors.toList(). List < String > monthNames = Arrays