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

StringjoinList(List list, String separator)
join List
String rtVal = "";
if (separator == null)
    separator = ",";
Iterator it = list.iterator();
while (it.hasNext()) {
    rtVal += (String) it.next() + separator;
if (rtVal.length() > 1)
...
StringjoinList(List items)
joins a list of elements eg [a, b, c] into a string of the form: "a", "b", "c" if the list is empty: returns "\"\"" (that is, a string containing two " characters, not an empty string)
return "\"" + String.join("\", \"", items) + "\"";
StringjoinList(List list, String glue)
join List
Iterator<String> i = list.iterator();
if (i.hasNext() == false) {
    return "";
StringBuffer res = new StringBuffer();
res.append(i.next());
while (i.hasNext()) {
    res.append(glue + i.next());
...
StringjoinList(List list, String separator)
join List
if (list == null) {
    return null;
int size = list.size();
if (size == 0) {
    return "";
} else if (size == 1) {
    return list.get(0);
...
StringjoinList(List parts, String sep)
Join a List of Strings with a separator.
if (parts == null || parts.isEmpty()) {
    return "";
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String part : parts) {
    if (first) {
        first = false;
...
StringjoinList(String separater, List list)
Join a list of string together
String result = "";
for (int i = 0; i < list.size(); i++) {
    result = result + list.get(i) + separater;
if (!result.equals("")) {
    result = result.substring(0, result.length() - separater.length());
return result;
...
ListjoinLists(final List> lists)
Joins the items of multiple lists into one list.
if (lists.size() == 0) {
    return new ArrayList<GPItem>(0);
final List<GPItem> joined = new ArrayList<GPItem>(lists.size() * lists.get(0).size());
for (final List<GPItem> list : lists) {
    joined.addAll(list);
return joined;
...
ListjoinLists(List A, List B, double epsilon)
Join together 2 ordered lists of doubles into a single, ordered list without duplicates.
List<Double> C = new ArrayList<Double>();
int nA = 0;
int NA = A.size();
double a = A.get(nA);
int nB = 0;
int NB = B.size();
double b = B.get(nB);
while (nA < NA || nB < NB) {
...
ListjoinLists(List... list)
join Lists
List<T> result = new ArrayList<T>();
for (List<T> list2 : list) {
    result.addAll(list2);
return result;
StringjoinListToString(List lsStr, String sSeparator)
join List To String
StringBuilder builder = new StringBuilder();
boolean firstOcc = true; 
if (lsStr.size() == 1 && lsStr.get(0).equals("")) {
    return "";
for (int i = 0; i < lsStr.size(); i++) {
    if (firstOcc) {
        firstOcc = false;
...