title: Java ArrayList StringBuilder appending
body: <p>I have one problem when appending List values as String. I will be getting 1 or more than 1 value into the list. Then I need to append these string as one string and use a separator , for each string. But at the end also the comma is getting added. How Can I remove this at the end of the string dynamically. Here is my code:</p>
  
  <pre><code>cntList = parseXml(metadata.xml);
  if (cntList.size() != 0) {
      // entryCountryMap.put(id, country);
      System.out.println("Size is  ----&gt;" + cntList.size());
      StringBuilder sb = new StringBuilder();
      if (cntList.size() &gt;= 2) {
          for (String s : cntList) {
              sb.append(s);
              sb.append(",");
          }
      }
      System.out.println("StringBuilder -----&gt;" + sb.toString());
  }
  </code></pre>
  
  <p>And my output is like this:</p>
  
  <pre><code>StringBuilder -----&gt;All Countries,US - United States,
  </code></pre>
  
  <p>Please help me resolving this. Thanks - Raji</p>