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

StringjoinToString(List list)
join To String
StringBuffer strBuf = new StringBuffer();
if (list != null) {
    for (Object item : list) {
        strBuf.append(item.toString());
return strBuf.toString();
StringJoinToString(List list, String delimiter)

Given a List and a delimiter, creates a delimited string of the objects in the List (using the toString() method of each object).

return JoinToString(list, delimiter, false, null);
ListjoinUnique(List list, T element)
Joins a list with an element only if the element is not yet contained in the list.
return list.contains(element) ? new ArrayList<T>(list) : join(list, element);
StringjoinWordList(List wordList, String delimiter)
join Word List
if (wordList.size() == 0) {
    return null;
StringBuffer sb = new StringBuffer();
for (String e : wordList) {
    if (sb.length() > 0) {
        sb.append(delimiter);
    sb.append(e);
return sb.toString();
StringlistToStr(List list, String joinChar)
list To Str
if (isEmpty(list) || joinChar == null) {
    return "";
String listStr = "";
for (String item : list) {
    listStr = listStr + item + joinChar;
listStr = listStr.substring(0, listStr.length() - joinChar.length());
...
StringlistToText(List list, String join)
list To Text
StringBuilder builder = new StringBuilder();
for (String line : list) {
    builder.append(line).append(join);
if (builder.length() > 0) {
    builder.deleteCharAt(builder.length() - 1);
return builder.toString();
...
ListorderJoinType(List jList)
order Join Type
List<String> tempList = new ArrayList<String>();
if (jList.get(0).equals("subject") && jList.get(2).equals("object")) {
    tempList.add(jList.get(2));
    tempList.add(jList.get(0));
    tempList.add(jList.get(3));
    tempList.add(jList.get(1));
    return tempList;
} else {
...
ListreverseJoinType(List jList)
reverse Join Type
List<String> tempList = new ArrayList<String>();
if (jList.get(2).equals("subject") && jList.get(3).equals("object")) {
    tempList.add(jList.get(3));
    tempList.add(jList.get(2));
    tempList.add(jList.get(1));
    tempList.add(jList.get(0));
    return tempList;
} else if (jList.get(2).equals("predicate") && jList.get(3).equals("subject")) {
...
StringsortAndJoin(List col, String sep)
sort And Join
Collections.sort(col);
return join(col, sep);
StringsortAndJoin(List list)
sort And Join
Collections.sort(list);
StringBuilder builder = new StringBuilder(10 * list.size());
String sep = "";
for (String name : list) {
    builder.append(sep);
    builder.append(name);
    sep = " ";
return builder.toString();