I have an ArrayList<String>
that is added to periodically. What I want to do is to cast the entire ArrayList to a String
without doing a loop. Can anybody tell me is it possible without using loop?
Edited: So we found some solutions, Like
list.stream().collect(Collectors.joining());
Or
String result = String.join(",", list);
or some others as well. Now Just for getting knowledge I put a question which one is the most optimal way for compiler?