Java Utililty Methods List Join

List of utility methods to do List Join

Description

The list of methods to do List Join are organized into topic(s).

Method

Listjoin(List list1, List list2)
join
List<String> list = new ArrayList<String>();
for (String cur : list1) {
    if (!list.contains(cur)) {
        list.add(cur);
for (String cur : list2) {
    if (!list.contains(cur)) {
...
Listjoin(List list1, List list2)
join
List<String> join = new ArrayList<String>(list1);
join.addAll(list2);
return join;
Stringjoin(List lst, int start, int end)
join
return join(lst, start, end, " ");
Stringjoin(List lst, String separator)
Joining by separator after each 'not last' value
if (lst == null)
    return "";
StringBuilder str = new StringBuilder();
Iterator<String> iter = lst.iterator();
while (iter.hasNext()) {
    str.append(iter.next());
    if (iter.hasNext()) {
        str.append(separator);
...
Stringjoin(List members, boolean quote)
Helper to join a list of strings to a optionally quoted, comma separated string.
StringBuilder builder = new StringBuilder();
for (int i = 0; i < members.size(); ++i) {
    if (i != 0) {
        builder.append(",");
    if (quote) {
        builder.append('"').append(members.get(i)).append('"');
    } else {
...
Stringjoin(List p_sStrList, String p_sDelimiter)
The method concatenates a list of strings with the given delimiter
StringBuilder sb = new StringBuilder();
for (String sCurrStr : p_sStrList) {
    if (sb.length() > 0)
        sb.append(p_sDelimiter);
    sb.append(sCurrStr);
return sb.toString();
Stringjoin(List parts, String separator)
Joins a list of strings using the specified separator.
Iterator<String> it = parts.iterator();
StringBuilder builder = new StringBuilder();
while (it.hasNext()) {
    String part = it.next();
    builder.append(part);
    if (it.hasNext()) {
        builder.append(separator);
return builder.toString();
Stringjoin(List paths)
join
if (paths == null || paths.isEmpty()) {
    return null;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < paths.size(); i++) {
    if (i == 0) {
        sb.append(trimTrailingSlash(paths.get(i)));
    } else {
...
Stringjoin(List s, String delim)
join
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.size() - 1; i++) {
    sb.append(s.get(i));
    sb.append(delim);
if (s.size() > 0)
    sb.append(s.get(s.size() - 1));
return sb.toString();
...
Stringjoin(List s, String sep)
join
String r = s.get(0);
for (int i = 1; i < s.size(); i++) {
    r += sep + s.get(i);
return r;