This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
java_faq [2016/09/22 11:43] 178.237.8.52 [ArrayList] |
java_faq [2016/09/22 11:44] 178.237.8.52 [ArrayList] |
||
---|---|---|---|
Line 200: | Line 200: | ||
[edo, def, ghi] | [edo, def, ghi] | ||
- | Great! However we don't have the flexibility we wanted because the asList method [https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList-T...- Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array]. So if one tries to add an element to the list the compiler complains ''uses unchecked of unsafe operations'' and upon execution it throws a java.lang.UnsupportedOperationException | + | Great! However we don't have the flexibility we wanted because the asList method [[https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList-T...- | Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array]]. So if one tries to add an element to the list the compiler complains ''uses unchecked of unsafe operations'' and upon execution it throws a java.lang.UnsupportedOperationException |
- | Not great!!! We need an ArrayList that is a [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html Resizable-array implementation of the List interface.] | + | Not great!!! We need an ArrayList that is a [[https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html | Resizable-array implementation of the List interface.]] |
We cannot create the ArrayList from the String[] because the constructor of the ArrayList takes only int or Collections as parameters. | We cannot create the ArrayList from the String[] because the constructor of the ArrayList takes only int or Collections as parameters. |