如何使用Collectors.toList/toSet/toMap创建一个UnmodifiableList/Set/Map,因为toList(等等)文档如下:Therearenoguaranteesonthetype,mutability,serializability,orthread-safetyoftheListreturned在java-10之前,您必须提供带有Collectors.collectingAndThen的Function,例如:Listresult=Arrays.asList(1,2,3,4).stream().collect(Collectors.collect