Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android 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
Comment

android list to string

String[] data = { "First", "Second", "Third" };
StringBuilder sb = new StringBuilder();
for (String item : data) {
  sb.append(item).append(", ");
}
sb.setLength(sb.length() - 2);

// generates output:
// First, Second, Third
Comment

PREVIOUS NEXT
Code Example
Java :: mettre caractère de string en majuscule java 
Java :: Java Hashmap Replace Elements 
Java :: how to use setonclicklistener from custom view in android 
Java :: java zahlen runden auf 1 nachkommastelle 
Java :: 9999999999999 
Java :: difference between linkedlist and arraylist 
Java :: sort arrays by first element java 
Java :: Java comment vérifier une égalité de String 
Java :: width and height of screen java 
Java :: get sum of array and return string 
Java :: prime factorization java 
Java :: where to use findviewbyid in fragment 
Java :: how to make window in java 
Java :: java take and save screenshot 
Java :: how to compare doubles in java 
Java :: stringbuilder java setlength 
Java :: get field name java 
Java :: remove element from char array java 
Java :: java dictionary initialization 
Java :: java multi thread 
Java :: limit decimals java 
Java :: Java List Access Elements using get() method 
Java :: The Longest Substring 
Java :: convert string into unicode java 
Java :: java servlet life cycle 
Java :: loop and save letters in a string java 
Java :: array buffer 
Java :: java put() method 
Java :: kafkalistener annotation pass topic from properties file 
Java :: how to Compile the source code in ./src folder with libraries in ./lib folder using JavaSE-1.7 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =