• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting java.lang.UnsupportedOperationException on adding List  RSS feed

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


On adding two list ll1 and ll2 , i'm getting UnsupportedOperationException , why ?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The List returned by Arrays.asList is not immutable, but it's size is still fixed - it doesn't allow elements to be added or removed, only replaced.
 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you !
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:The List returned by Arrays.asList is not immutable, but it's size is still fixed


...as clearly indicated by the documentation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!