Java snippets, tricks and tips




Android Java: Join list items with delimiter

Using TextUtils.join(delimiter, tokens)

List<String> list = new ArrayList<>();
list.add("item 1");
list.add("item 2");
list.add("item 3");
String text = TextUtils.join("; ", list);