Collections.unmodifiableList(
If somebody tries to edit the derived list, they will get a neat UnSupportedOperationException. You might wonder why would you need such a list.. If you are working on project with some 50 odd people and you need to make sure that your list (which could be used in some other place) should not be modified by any other fellow programmer, this is the right way to do..!
Happy programming !
This could really come handy in some scenarios as I said above..
Good Bye!
No comments:
Post a Comment