• +91 9723535972
  • info@interviewmaterial.com

Java Interview Questions and Answers

Question - How do you create a read-only collection?

Answer - The Collections class has six methods to help out here: 1. unmodifiableCollection(Collection c) 2. unmodifiableList(List list) 3. unmodifiableMap(Map m) 4. unmodifiableSet(Set s) 5. unmodifiableSortedMap(SortedMap m) 6. unmodifiableSortedSet(SortedSet s) If you get an Iterator from one of these unmodifiable collections, when you call remove(), it will throw an UnsupportedOperationException.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners