1String string = list.stream().map(Object::toString).collect(Collectors.joining(""));
1//Creating arraylist example
2ArrayList<String> list = new ArrayList<String>();
3
4//Adding objects in arraylist
5list.add("Mango");
6list.add("Banana");
7
8//Change the element (index,"new value")
9list.set(1,"Dates");
10
11//Return the 2nd element, because index starts from 0
12System.out.println("Returning element: " + list.get(1));
1ArrayList<String> list=new ArrayList<String>();//Creating arraylist
2 list.add("Mango");//Adding object in arraylist
3 list.add("Apple");
4 list.add("Banana");
5 list.add("Grapes");
6 //Printing the arraylist object
7 System.out.println(list);