How to cast a list of strings to a string array?
Answers
Answered by
0
List.toArray()
import java. util. Arrays;import java. util. List;class ListUtil.{// convert list of string to array of string in Java.public static void main(String[] args) {List<String> list = Arrays. asList("NYC", "New Delhi");String[] array = list. toArray(new String[0]);
Similar questions
Social Sciences,
7 months ago