Java: set-size List issue UnsupportedOperationException thrown
Posted
by tuckster
on Stack Overflow
See other posts from Stack Overflow
or by tuckster
Published on 2010-04-30T16:21:46Z
Indexed on
2010/04/30
16:27 UTC
Read the original article
Hit count: 156
I am having a problem changing a List that has a set-size in Java.
I understand that I can't add or remove from this list but why can't I use set? When I use set the UnsupportedOperationException is thrown as well as when I use add and remove which is expected.
set
public Object set(int index,
Object element)
Replaces the element at the specified position in this list with the specified element (optional operation).
I understand its an optional operation its just that want to replace that one element of the list with another element. Is there any way I can do this?
© Stack Overflow or respective owner