SaravanaKumar Venugopal wrote:Thanks for the prompt response Keith Lynn
Am sorry the code was like given below and it thrown UnsupportedOperationException and when I googled it has been said as when we convert to list by Arrays.asList() which will return fixed size of list and when we try to modify we will be getting UnsupportedOperationException. And there is no issue with the original post.
<code>
String s1 = "Value1,Value2,Value3,Value4";
List<String> lStr1 = Arrays.asList(s1.split(","));
lStr1.add("");
</code>
In your original post, you were converting a list to a synchronized list. When you do that, you can add to it.
In this example, you are taking an array and treating it as a list.
But since it is still an actual array, you cannot add to it.