I have an Array and an ArrayList like below
String[] stringArray = new String[] {"a","b","c","d","e"};
List<String> stringList = new ArrayList<>();
stringList.add("p");
stringList.add("q");
stringList.add("r");
I want to copy stringList to stringArray. I tried with ArrayList.toArray() method but it set null to fourth element of Array. Is there any way I can do this by without using a for loop
Expected O/P
{"p","q","r","d","e"}