2
I don’t have much knowledge of Java, I would like to separate the string from my List, with ", ".
List<String> nomes = Arrays.asList("Paulo", "Ana", "Zeno", "Beno");
for(int i=0; i<nomes.size(); i++) {
System.out.format("%s%s", nomes.get(i),
i != nomes.size() - 1 ? ", " : " ");
}
But I didn’t find a good solution, I tried with the foreach
of Java 8, but I could not.
Have you ever tried to do something like
String.join(", ", nomes)
?– Woss
Only to display on screen? If yes, just
System.out.println(nomes);
see: https://ideone.com/f0yjBL– user28595
Was that right.
– Bozo