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

convert collections to string

ssasi kumar

Joined: Feb 23, 2011
Posts: 26

hi everybody,

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

with regards,

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

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

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

Joined: Aug 16, 2005
Posts: 14596

Just call toString() on the collection.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Anooj Narvekar

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.
jQuery in Action, 2nd edition
subject: convert collections to string