please see the code given below
i am getting the following Exception during runtime
element 0::test0
element 1::test1
element 2::test2
element 3::test3
element 4::test4
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:91)
at ListTest.main(ListTest.java:24)
After seeing all the javadocs , what i understood is Arrays.asList returns a fixedsize list backed by array .
is this Exception has anything to do with this Fixed Size?
what i am thinking is as it returns a fixed size list we are not allowed to add new elements to it ,please tell me whether i am correct or not .If this is the case , wouldn't it throw some other exception?
sorry if this is a silly question.
Thanks in advance
i am getting the following Exception during runtime
element 0::test0
element 1::test1
element 2::test2
element 3::test3
element 4::test4
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:91)
at ListTest.main(ListTest.java:24)
After seeing all the javadocs , what i understood is Arrays.asList returns a fixedsize list backed by array .
is this Exception has anything to do with this Fixed Size?
what i am thinking is as it returns a fixed size list we are not allowed to add new elements to it ,please tell me whether i am correct or not .If this is the case , wouldn't it throw some other exception?
sorry if this is a silly question.
Thanks in advance