title: How to override the ArrayList's ToString method so that the comma delimiter be replaced by other symbols?
body: <pre><code>class Person {
    public String firstname;
    public String lastname;
  }
  
  Person p1 = new Person("Jim","Green");
  Person p2 = new Person("Tony","White");
  
  ArrayList&lt;Person&gt; people = new ArrayList&lt;Person&gt;();
  
  people.add(p1);
  people.add(p2);
  
  System.out.println(people.toString());
  </code></pre>
  
  <p>I have to override class Person's <code>ToString</code> method so that p1.toString() yields <code>Green, Jim</code>. As a result, the output of the code above will be <code>[Green, Jim,White, Tony]</code> which is not desirable. It would be easier for text processing programs if the output is, for example <code>[Green, Jim&amp;White, Tony]</code>. The default delimiter needs to be replaced by other symbols such as &amp;. What is the simplest way to achieve that if there is any?</p>