java: (String[])List.toArray() gives ClassCastException
why does List<String>.toArray() return Object[] and not String[]? how to work around this?
Collection.toArray() java.lang.ClassCastException Return type of List<E> toArray() method Java List <T> T[] toArray(T[] a) implementation What's the use of new String[0] in toArray(new String[0]); Why i get ClassCastException? Why is toArray implemented like this in java? GXT3 - ColumnSelectionAppearance ClassCastException Why do I get a ClassCastException? ClassCastException in Java method toArray() not working on a list Need for new String[0] in the Set toArray() method Difference between toArray(T[] a) and toArray() Why do I get a ClassCastException here? In which condition which overloaded version of toArray() and toArray(T[] a) should be use? How to convert hash Set into array using toArray() if the method toArray is not specified? T[] toArray(T[] a) implementation ArrayList.toArray() method in Java toArray(T[]) method in ArrayList List.toArray(Object[]) performance Why can't i have classcastexception? Java List toArray(T[] a) implementation Convert list to array using toArray Java classcastexception list.toArray(T[] a), what if the "T" is a "runtime type"? toArray() vs. toArray(new Object[0]) Java ClassCastException Convert list of strings to array of strings - difference between (String[])list.toArray() and list.toArray(new String[0]) ClassCastException String to Object[] ClassCastException in java