Posted: Wed Aug 19, 2009 4:27 pm Post subject: help with ArrayList.toArray();
I'm trying something with the ArrayList, and encountered a problem. Using generics, I've made an ArrayList with type String. So I'm expecting i can safely operate Strings with the arraylist. But soon I found that the toArray() method of the array list returns Object[], not String[] (I didn't try casting because I figured that I couldn't cast from an Object to String anyways). I looked in the Javadoc for ArrayList. It had two toArray methods. One that I used, and one that I don't really understand. Can someone show me how to use the other one? here's the Javadoc for arrayList that I used: