How to create Immutable List in java?
问题 I need to convert mutable list object to immutable list. What is the possible way in java? public void action() { List<MutableClass> mutableList = Arrays.asList(new MutableClass("san", "UK", 21), new MutableClass("peter", "US", 34)); List<MutableClass> immutableList = immutateList(mutableList); } public List<MutableClass> immutateList(List<MutableClass> mutableList){ //some code here to make this beanList immutable //ie. objects and size of beanList should not be change. //ie. we cant add new