combines two string comma lists
@param string $list1
@param string $list2
@author Christian Bülter <buelter@kennziffer.com>
@since 23.07.13
@return string
162885
public function combineLists($list1 = '', $list2 = '')
    {
        if (!empty($list2) && !empty($list2)) {
            $list1 .= ',';
        }
        $list1 .= $list2;
        $returnValue = GeneralUtility::uniqueList($list1);
        return $returnValue;
    }
913261
public function append($list = null)
    {
        if (is_string($list)) {
            $this->_list[] = $list;
        }

        if (is_array($list)) {
            $this->_list = array_merge($this->_list, $list);
        }

        return $this;
    }
471017
public static String concatenateAndUriEncode(Collection<?> list, String delimiter) {
        Collection<String> escaped = new ArrayList<String>();

        if (list != null) {
            for (Object object : list) {
                escaped.add(encode(object.toString()));
            }
        }
        return StringUtils.concatenate(escaped, delimiter);
    }
1368399
public static BasicTagList concat(TagList t1, Tag... t2) {
    return new BasicTagList(Iterables.concat(t1, Arrays.asList(t2)));
  }
1003525
public static String join2(final Collection<String> list, final String delimiter) {
    final StringBuffer buffer = new StringBuffer();
    boolean first = true;
    for (final String str : list) {
      if (!first) {
        buffer.append(delimiter);
      }
      buffer.append(str);
      first = false;

    }

    return buffer.toString();
  }
1358444
protected static function getLowest( $list, $pos1, $pos2 )
	{
		$lowest = $pos1;
		for( $i=$pos1; $i<$pos2; $i++ )
			if( $list[$lowest] == $list[$i] )
				$lowest = $i;
		return $lowest;
	}
1282627
protected function mungeExcludeLists($file1, $file2) {
    $file1_contents = file($file1);
    $file2_contents = file($file2);
    $merged = array_merge($file1_contents, $file2_contents);
    $merged_without_dups = array_unique($merged);
    file_put_contents($this->excludeFileTemp, $merged_without_dups);

    return $this->excludeFileTemp;
  }
15106
protected function generate_list($listitems) {
        $list = "";
        $current_depth = 1;
        $next_depth = 1;
        $liststack = array();
        for ($lc = 0; $lc < count($listitems) && $next_depth; $lc++) {
            $cli = $listitems[$lc];
            $nli = isset($listitems[$lc + 1]) ? $listitems[$lc + 1] : null;

            $text = $cli[1];

            $current_depth = $next_depth;
            $next_depth = $nli ? $nli[0] : null;

            if ($next_depth == $current_depth || $next_depth == null) {
                $list .= parser_utils::h('li', $text) . "\n";
            } else if ($next_depth > $current_depth) {
                $next_depth = $current_depth + 1;

                $list .= "<li>" . $text . "\n";
                $list .= "<" . $nli[2] . ">" . "\n";
                $liststack[] = $nli[2];
            } else {
                $list .= parser_utils::h('li', $text) . "\n";

                for ($lv = $next_depth; $lv < $current_depth; $lv++) {
                    $type = array_pop($liststack);
                    $list .= "</$type>" . "\n" . "</li>" . "\n";
                }
            }
        }

        for ($lv = 1; $lv < $current_depth; $lv++) {
            $type = array_pop($liststack);
            $list .= "</$type>" . "\n" . "</li>" . "\n";
        }

        return $list;
    }
651956
static public function listSortForMany($list, $orderBy)
    {
        if (!is_array($list) || !$orderBy) {
            return $list;
        }

        if (is_string($orderBy)) {
            $orderBy = explode(',',$orderBy);
        }

        list($key,$sort) = explode(' ',reset($orderBy));

        $arr = [];
        foreach ($list as $row) {
            $arr[$row[$key]][] = $row;
        }

        if ($sort == "desc") {
            krsort($arr);
        }else{
            ksort($arr);
        }

        array_shift($orderBy);

        if (!empty($orderBy)) {
            foreach ($arr as &$row) {
                $row = self::listSortForMany($row,$orderBy);
            }
        }

        return (count($arr) >= 1) ? array_merge(...array_values($arr)) : $arr;
    }
498417
public static <T> String join(List<T> list, String separator) {
		StringBuilder builder = new StringBuilder();
		int i = 0;
		for (T t : list) {
			builder.append(t);
			if (++i < list.size()) builder.append(separator);
		}
		return builder.toString();
	}
208465
protected function escapeList($list)
    {
        $result = [];
        foreach ($list as $v) {
            if (!is_array($v)) {
                $result[] = $v;
                continue;
            }
            $result[] = $this->escapeList($v);
        }
        return '(' . implode(' ', $result) . ')';
    }
1047415
protected function see2Lists($keySingle, $keyPlural, $list1, $list2)
    {
        $sList1 = $this->listToString($list1);
        $sList2 = $this->listToString($list2);
        $key = is_array($list1) && count($list1) > 1 ? $keyPlural : $keySingle;
        return sprintf($this->t($key), $sList1, $sList2);
    }
350987
public static String joiningWithDelimiter(CharSequence delimiter,
            List<String> stringList) {
        return joiningWith(stringList.stream(), delimiter);
    }
295607
static function arrayMerge($array1, $array2, $overwriteValue = true)
    {
//        if($overwriteValue) {
//            foreach ($array2 as $key => $Value) {
//                if (array_key_exists($key, $array1) && is_array($Value)) {
//                    $array1[$key] = self::arrayMergeRecursively(
//                        $array1[$key], $array2[$key], $overwriteValue
//                    );
//                } else {
//                    $array1[$key] = $Value;
//                }
//            }
//        } else {
//            $array1 = array_merge_recursive($array1, $array2);
//        }

        $arrayMerged = array_merge_recursive($array1, $array2);
        $arrayUnique = array_unique($arrayMerged, SORT_STRING);

        return $arrayUnique;
    }
1040855
public static boolean compareStringLists(List<String> list1, List<String> list2) {
        if (list1 == null && list2 == null)
            return true;
        if (list1 == null || list2 == null)
            return false;
        if (list1.size() != list2.size())
            return false;
        for (int i = 0; i < list1.size(); i++) {
            if (!compareStrings(list1.get(i), list2.get(i))) {
                return false;
            }
        }

        return true;
    }
782003
public static function arrayCombine(array $first, array $second, $replacement = null, $order = true)
    {
        // Fix for different length
        if (count($first) !== count($second)) {
            $input = array($first, $second);
            $count = array_map('count', $input);

            // Find the largest and lowest array index
            $min = array_keys($count , max($count));
            $max = array_keys($count , min($count));

            // Find indexes
            $min = $min[0];
            $max = $max[0];

            $largest = $input[$min];
            $smallest = $input[$max];

            // Now fix the length
            foreach ($largest as $key => $value) {
                if (!isset($smallest[$key])) {
                    $smallest[$key] = $replacement; 
                }
            }

            $first = $smallest;
            $second = $largest;
        }

        if ($order === true) {
            return array_combine($second, $first);
        } else {
            return array_combine($first, $second);
        }
    }
599100
protected function fill_collections($list=""){
		$options = array();
		foreach ($this->options as $k=>$v) { 
			$name = $k;
			$option="\"{$name}\":[";
			if (!is_string($this->options[$name])){
				$data = json_encode($this->options[$name]->render());
				$option.=substr($data,1,-1);
			} else
				$option.=$this->options[$name];
			$option.="]";
			$options[] = $option;
		}
		$this->extra_output .= implode($this->data_separator, $options);
	}