aspose file tools
The moose likes Beginning Java and the fly likes convert collections to string Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "convert collections to string " Watch "convert collections to string " New topic
Author

convert collections to string

ssasi kumar
Greenhorn

Joined: Feb 23, 2011
Posts: 21

hi everybody,

i have one doubt how to convert collections(ArrayList,List,vector) to string......





with regards,

sasikumar
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Collections of what ? And how do you intend to separate each item ?


[My Blog]
All roads lead to JavaRanch
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

Just call toString() on the collection.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Anooj Narvekar
Greenhorn

Joined: Feb 08, 2011
Posts: 10

Collections override toString method. It internally calls toString of Objects its holding. So if the objects its holding has overriden toString as required, then collection.toString should be what you actually want.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: convert collections to string
 
Similar Threads
String array to arraylist
amount of digits entered(without a tokenizer)....
how to subtract two strings
How to convert String to org.w3c.dom.Document
how to convert Byte to the String