Tuesday, October 27, 2015

Core Java - How will you make Collections readOnly ?



We can make the Collection readOnly by using the following lines code:

General : Collections.unmodifiableCollection(Collection c)

Collections.unmodifiableMap(Map m)
Collections.unmodifiableList(List l)
Collections.unmodifiableSet(Set s)

No comments:

Post a Comment