This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Folks, is it possible to get a String from an ArrayList ?? What i think of specially is ArrayList.toArray() but this returns an Object I tried it with the following line of code: String temp = (String)list.toArray(); but this throws a class cast exception. Any idea ?? Thx
toArray public Object toArray(Object�a) Returns an array containing all of the elements in this list in the correct order. The runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list. If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements
Hope that helps! [ June 19, 2002: Message edited by: Jessica Sant ]