Google News
logo
Java Collections - Interview Questions
Explain the method to convert ArrayList to Array and Array to ArrayList
Programmers can convert an Array to ArrayList using asList() method of Arrays class. It is a static method of Arrays class that accept the List object. The syntax of asList() method is :
Arrays.asList(item)
Java programmers can convert ArrayList to the List object using syntax :
List_object.toArray(new String[List_object.size()])
Advertisement