This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

collections.remove()

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys
i tried this code below



but i end up in exception below



i dont know the reason
looking for yopur replies
amir
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is optional for a class that implements the Collection interface to allow objects to be the removed. If it doesn't want to allow objects to be removed, then it's implementation of the remove method should just throw an UnsupportedOperationException. Obviously the object that Arrays.asList returns has chosen to do this.
[ April 24, 2008: Message edited by: Joanne Neal ]
 
Vilmantas Baranauskas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arrays.asList(s) returns unmodifiable collection. Therefore you need to use other collection:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic