Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java arraylist to string

ArrayList<String> al = new ArrayList<String>();
      al.add("Hello");
      al.add("Wor");
      al.add("ld");
      StringBuffer sb = new StringBuffer();
      
      for (String s : al) {
         sb.append(s);
         sb.append(" ");
      }
      String str = sb.toString();
      System.out.println(str);//"Hello wor ld" 
Comment

arraylist items into string

String listString = String.join(", ", list); //Java 8 or later
Comment

arraylist to string

ArrayList<String> list = new ArrayList<String>();
list.add("one");
list.add("two");
list.add("three");

String listString = "";

for (String s : list)
{
    listString += s + "	";
}

System.out.println(listString);
Comment

PREVIOUS NEXT
Code Example
Java :: convert arraylist to csv file java 
Java :: print list array 
Java :: final method meaning 
Java :: check palindrome in java 
Java :: how to find a word in string in java 
Java :: java print 
Java :: implementing iterator for linked list java 
Java :: cannot find symbol variable log 
Java :: How to initialize a 2d array in Java? 
Java :: java declare array 
Java :: java while loop example 
Java :: initial data for list java 
Java :: string tokenizer java 
Java :: copy elements of array in java 
Java :: sort descending java stream 
Java :: sort an int array java 
Java :: How to efficiently convert a sorted array into a min height binary search tree, in Java? 
Java :: arrays.aslist 
Java :: java enums 
Java :: jframe color 
Java :: intent android 
Java :: list of integers in java 
Java :: java set foreach 
Java :: each character in string java 
Java :: radio button android:inputType 
Java :: how to change the value of an arraylist in java 
Java :: simple function java 
Java :: java program for multiplication table 
Java :: render problem in android studio 
Java :: android java shared preferences remove key 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =