public String toCommaSeparatedString(){
  String result="";
  for (int i=0; i < contents.size(); i++) {
    if (result.equals("")) {
      result=contents.elementAt(i);
    }
 else {
      result=result + ", " + contents.elementAt(i);
    }
  }
  return result;
}

public String toCommaSeparatedString ( ) { String result = "" ; for ( int i = 0 ; i < contents . size ( ) ; i ++ ) { if ( result . equals ( "" ) ) { result = contents . elementAt ( i ) ; } else { result = result + ", " + contents . elementAt ( i ) ; } } return result ; }
returns the comma - separated list of all the elements of the list . it returns " " if the set is empty .
