Join the parts of a path and append them to the given File.

@param fileBase is the file to put as prefix.
@param elements are the path's elements to join.
@return the result of the join of the path's elements.
977339
@Pure
	public static File join(File fileBase, File... elements) {
		if (fileBase == null) {
			return null;
		}
		final StringBuilder buf = new StringBuilder(fileBase.getPath());
		for (final File elt : elements) {
			if (!elt.isAbsolute() && buf.length() >= 0 && buf.charAt(buf.length() - 1) != File.separatorChar) {
				buf.append(File.separatorChar);
			}
			buf.append(elt.getPath());
		}
		return new File(buf.toString());
	}
632408
@Pure
	public static URL join(URL urlBase, File... elements) {
		if (urlBase == null) {
			return null;
		}
		final StringBuilder buf = new StringBuilder(urlBase.getPath());
		for (final File elt : elements) {
			if (!elt.isAbsolute() && (buf.length() == 0 || buf.charAt(buf.length() - 1) != URL_PATH_SEPARATOR_CHAR)) {
				buf.append(URL_PATH_SEPARATOR_CHAR);
			}
			buf.append(fromFileStandardToURLStandard(elt));
		}
		try {
			if (isJarURL(urlBase)) {
				return new URL(
						urlBase.getProtocol(),
						urlBase.getHost(),
						urlBase.getPort(),
						buf.toString());
			}
			return new URI(
					urlBase.getProtocol(),
					urlBase.getUserInfo(),
					urlBase.getHost(),
					urlBase.getPort(),
					decodeHTMLEntities(buf.toString()),
					decodeHTMLEntities(urlBase.getQuery()),
					urlBase.getRef()).toURL();
		} catch (Throwable exception) {
			//
		}
		try {
			return new URL(
					urlBase.getProtocol(),
					urlBase.getHost(),
					buf.toString());
		} catch (Throwable exception) {
			return null;
		}
	}
17392
public static <E extends Comparable<?>> TreeSet<E> newTreeSet(Iterable<? extends E> elements) {
		TreeSet<E> set = newTreeSet();
		for (E element : elements) {
			set.add(element);
		}
		return set;
	}
368985
public static String[] add(final String[] a, final String element) {
        if (N.isNullOrEmpty(a)) {
            return N.asArray(element);
        }

        final String[] newArray = new String[a.length + 1];

        copy(a, 0, newArray, 0, a.length);
        newArray[a.length] = element;

        return newArray;
    }
551518
public static String joinPaths(String prefix, String path, boolean generatedPath) {

		String result = null;
		if (generatedPath) {
			result = joinDomainToPath(prefix, path);
		} else {
			result = joinPaths(prefix, path);
		}
		return result;
	}
163756
private Set<String> convertAbsToRelative(Collection<File> files) {
        Set<String> result = new HashSet<String>();
        for (File f : files) {
            String fAbsPath = PathUtils.fixPathString(f); //assumption here that f is a dir, and path will end in File.seperator
            if (fAbsPath.startsWith(rootAbsolutePath)) {
                String absPath = fAbsPath; // canonicalPath(f);
                absPath = absPath.substring(rootAbsolutePath.length());
                if ("\\".equals(File.separator)) {
                    absPath = absPath.replace('\\', '/');
                }
                //handle / case. (path will have been the same, so the substring created emptystring)
                if (absPath.length() == 0) {
                    absPath = "/";
                }
                result.add(absPath);
            } else
                throw new IllegalStateException(fAbsPath + " " + rootAbsolutePath);
        }
        return result;
    }
118607
public UrlStringBuilder addPath(String... elements) {
        Validate.noNullElements(elements, "elements cannot be null");

        for (final String element : elements) {
            this.path.add(element);
        }
        return this;
    }
378794
@Nonnull
    public static String join(@Nonnull Iterable<String> elements, @Nonnull String delimiter) {
        StringBuilder result = new StringBuilder();
        Iterator<String> it = elements.iterator();
        while (it.hasNext()) {
            String element = it.next();
            result.append(element);
            if (it.hasNext()) {
                result.append(delimiter);
            }
        }
        return result.toString();
    }
424366
private static String join(String sep, Collection<String> collection) {
    StringBuilder builder = new StringBuilder();
    boolean first = true;
    for (String element : collection) {
      if (first) {
        first = false;
      } else {
        builder.append(sep);
      }
      builder.append(element);
    }
    return builder.toString();
  }
1272789
@SuppressWarnings({"rawtypes", "unchecked"})
    public static String join(final Collection<?> col, final String separator, final ElementConverter elementConverter) {

        if(col == null) {
            return "";
        }

        final int size = col.size();
        if(size == 0) {
            return "";
        }

        StringBuilder sb = new StringBuilder();
        for(Iterator<?> itr = col.iterator(); itr.hasNext();) {
            final Object element = itr.next();
            String text = elementConverter.convertToString(element);
            sb.append(text);

            if(separator != null && itr.hasNext()) {
                sb.append(separator);
            }
        }

        return sb.toString();

    }
1194109
public E union(E e1, E e2) {
	Node<E> node1 = _get_or_create_root_set(e1);
	Node<E> node2 = _get_or_create_root_set(e2);
	return _link(node1, node2).element;
    }
503466
public static String pathJoin(final String... pathElements) {

        final String path;

        if (pathElements == null || pathElements.length == 0) {
            path = File.separator;

        } else {

            final StringBuffer sb = new StringBuffer();

            for (final String pathElement : pathElements) {

                if (pathElement.length() > 0) {
                    sb.append(pathElement);
                    sb.append(File.separator);
                }
            }

            if (sb.length() > 0) {
                sb.deleteCharAt(sb.length() - 1);
            }

            path = sb.toString();
        }

        return (path);
    }
247795
@SuppressWarnings("rawtypes")
    public static String join(final Collection<?> col, final String separator,
            final boolean ignoreEmptyElement, final boolean trim, final ElementConverter elementConverter) {

        final List<Object> list = new ArrayList<Object>();
        for(Object element : col) {
            if(element == null) {
                continue;
            }

            Object value = element;

            if(element instanceof String) {
                String str = (String) element;
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim();
                }

            } else if(element instanceof Character && isEmpty(element.toString())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }

            } else if(char.class.isAssignableFrom(element.getClass())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }
            }

            list.add(value);

        }

        return join(list, separator, elementConverter);

    }
1330128
public FileFilterBuilder addExtensions(Iterable<String> extensions) {
        for (String extension : extensions) {
            // Ultimately, SuffixFileFilter will be used, and the "." needs to be explicit.
            this.extensions.add(extension.startsWith(".") ? extension : "." + extension);
        }
        return this;
    }
35595
public static String join(List<String> list) {
    if (list == null) {
      return null;
    }

    StringBuilder joined = new StringBuilder();
    boolean first = true;

    for (String element : list) {
      if (first) {
        first = false;
      } else {
        joined.append(",");
      }
      joined.append(element);
    }

    return joined.toString();
  }
396483
public void appendNodes(NodeSet nodes)
  {

    int nNodes = nodes.size();

    if (null == m_map)
    {
      m_mapSize = nNodes + m_blocksize;
      m_map = new Node[m_mapSize];
    }
    else if ((m_firstFree + nNodes) >= m_mapSize)
    {
      m_mapSize += (nNodes + m_blocksize);

      Node newMap[] = new Node[m_mapSize];

      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes);

      m_map = newMap;
    }

    System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes);

    m_firstFree += nNodes;
  }
829696
public void addPathElement(QPathEntry element) {
       if (relPath == null)
          this.relPath = new QPath(new QPathEntry[]{element});
       else
          this.relPath = QPath.makeChildPath(relPath, element, element.getIndex());
    }