본문 바로가기
Java

String[] To ArrayList<String>, ArrayList<String> To String[]

by onejunu 2020. 8. 25.

1) String[] To ArrayList<String>

String[] arr = ...;

ArrayList<String> list = new ArrayList<>(Arrays.asList(arr));

 

 

2) ArrayList<String> To String[]

ArrayList<String> list = ...;

String[] arr = list.toArray(new String[list.size()]);

댓글