This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How we can type cast TreeSet into String array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How we can type cast TreeSet into String array" Watch "How we can type cast TreeSet into String array" New topic
Author

How we can type cast TreeSet into String array

kalai sundar
Ranch Hand

Joined: May 25, 2005
Posts: 69
In my code

java.util.TreeSet tm = new java.util.TreeSet(java.util.Arrays.asList(row));

this tm returns treeset right
i want this tm object to be copied to String[] array how i can do it

How i can do it , anyone hepl me


kalai
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
This isn't casting but it works:

String[] array = (String[])set.toArray( new String[0] );


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How we can type cast TreeSet into String array