list - Adding new line delimitter instead of Comma between Elements except the First Element in java -


i want add new line delimitter between elements of list in java comma delimitted, how can able achieve this? eg: if list [arol, jacob, joseph]

can able achieve similay

[ arol  jacob  joseph ] 

using power of java 8 can join:

list<string> myist = arrays.aslist("arol", "jacob", "joseph"); string result = string.join("\n", myist);  system.out.println(result); 

the result

arol jacob joseph 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -