JavaScript has Array.join()
js>[\"Bill\",\"Bob\",\"Steve\"].join(\" and \")
Bill and Bob and Steve
Does Java have anything
With a java 8 collector, this can be done with the following code:
Arrays.asList("Bill", "Bob", "Steve").stream()
.collect(Collectors.joining(" and "));
Also, the simplest solution in java 8:
String.join(" and ", "Bill", "Bob", "Steve");
or
String.join(" and ", Arrays.asList("Bill", "Bob", "Steve"));