How to make a List (ArrayList,Vector,LinkedList) read only?

Solution

A list implemenation can be made read only using Collections.unmodifiableList(list). This method returns a new list. If a user tries to perform add operation on the new list; UnSupportedOperationException is thrown.

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media