Home  >  Forum  >  Core Java
Post New Query


Asked on May 26, 2013
Hi friends, I am adding element in the list returned by Collections.nCopies and got below error.
Any clue?

Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.add(Unknown Source)
at java.util.AbstractList.add(Unknown Source)

Replied on May 26, 2013
The List in which you are adding the content are immutable. The list are immutable if  returned by
Collections.nCopies and Collections.emptyList 

Write Answer

©2022 concretepage.com | Privacy Policy | Contact Us