public String toString(String sep){
  if (isEmpty()) {
    return "";
  }
 else {
    StringBuilder buf=new StringBuilder();
    buf.append(head);
    for (List<A> l=tail; l.nonEmpty(); l=l.tail) {
      buf.append(sep);
      buf.append(l.head);
    }
    return buf.toString();
  }
}

public String toString ( String sep ) { if ( isEmpty ( ) ) { return "" ; } else { StringBuilder buf = new StringBuilder ( ) ; buf . append ( head ) ; for ( List < A > l = tail ; l . nonEmpty ( ) ; l = l . tail ) { buf . append ( sep ) ; buf . append ( l . head ) ; } return buf . toString ( ) ; } }
form a string listing all elements with given separator character .
