Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java string stringbuilder array list tostring

ArrayList<String> data = new ArrayList<String>();
data.add("First");
data.add("Second");
data.add("Third");

StringBuilder sb = new StringBuilder();
for (String item : data) {
  sb.append(item).append("
");
}
sb.setLength(sb.length() - 1);

// generates output:
// First
// Second
// Third
 
PREVIOUS NEXT
Tagged: #java #string #stringbuilder #array #list #tostring
ADD COMMENT
Topic
Name
3+9 =