title: Replace comma with newline in java
body: <p>My requirement is to replace all commas in a string with newline.</p>
  
  <p>Example:</p>
  
  <pre><code>AA,BB,CC
  </code></pre>
  
  <p>should represent as</p>
  
  <pre><code>AA
  BB
  CC
  </code></pre>
  
  <p>here's my implementation to replace commas with newline,</p>
  
  <pre><code>public String getFormattedEmails(String emailList) {
      List&lt;String&gt; emailTokens = Arrays.asList(emailList.split(","));
      String emails = "";
      StringBuilder stringBuilder = new StringBuilder();
      String delimiter = "";
      for(String email : emailTokens){
          stringBuilder.append(delimiter);
          stringBuilder.append(email);
          delimiter = "\n";
      }
      emails = stringBuilder.toString();
      return emails;
  }
  </code></pre>
  
  <p>this method replaces all commas with a space.
  can anyone point me where did I go wrong?</p>