1List<String> list = new ArrayList<>();
2list.add("a");
3list.add("ab");
4list.add("abc");
5list.add("abcd");
6// convert
7String[] array = list.toArray();
1ArrayList<String> ArrayLister=new ArrayList<>(){ArrayLister.add("Hi")};
2String[] array=ArrayLister.toArray(String[]);
3
1List<String> stockList = new ArrayList<String>();
2stockList.add("stock1");
3stockList.add("stock2");
4
5String[] stockArr = new String[stockList.size()];
6stockArr = stockList.toArray(stockArr);
7
8for(String s : stockArr)
9 System.out.println(s);