rajannagpal
asked on
Arraylist into comma seprated list
I have an arraylist of salesCycle object and I want to convert this arraylist into a comma separated String. For example:
Arraylist of sales Cycle and salesCycle has one of the property cycleID I need the following result :
String cycles =salesCycle.cycleId1, salesCycle.cycleId2,&
Arraylist of sales Cycle and salesCycle has one of the property cycleID I need the following result :
String cycles =salesCycle.cycleId1, salesCycle.cycleId2,&
You can do the following if your salesCycle object implements toString properly:
String cycles = list.toString();
ASKER
what should under toString method of salesCycle?
The representation you want it to have, e.g.
publ
public String toString() {
return "" + id;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.