Java Utililty Methods List Merge

List of utility methods to do List Merge

Description

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

Method

StringmergeString(List strs)
merge String
StringBuffer sBuffer = new StringBuffer();
for (String s : strs) {
    sBuffer.append(s);
return sBuffer.toString();
StringmergeTimeStrings(List strs)
merge Time Strings
StringBuilder sb = new StringBuilder();
for (int i = strs.size() - 1; i >= 0; i--) {
    sb.append(strs.get(i));
    sb.append(' ');
int lastChar = sb.length() - 1;
if (lastChar >= 0) {
    sb.deleteCharAt(lastChar);
...
voidmergeTo(List target, List source)
merge To
if ((target == null) || (source == null)) {
    return;
target.addAll(source);
ListmergeToList(Object src, Object... args)
merge To List
List valList = new ArrayList();
add(valList, src);
for (Object arg : args) {
    add(valList, arg);
return valList;
ListmergeUniqElems(List src, List dest)
merge Uniq Elems
if (dest == null) {
    return src;
if (src == null) {
    return dest;
int pos = 0;
while (pos < dest.size()) {
...
voidsafetyMergeCollection(List src, List target)
Safety add element included in source collection to target collection if target has already had element that is included in source collection, it doesn't add element to target
for (Iterator it = src.iterator(); it.hasNext();) {
    Object data = it.next();
    if (!target.contains(data)) {
        target.add(data);