将多个数组内连接

@param list     多个数组集合，不能为空
@param function 连接函数，使用该函数连接，不能为空
@param <T>      数组内数据类型
@return 内连接结果，例如原数组为[[1,2],[3,4],[5,6]]，内连接结果为[135,136,145,146,235,236,245,246]
551346
public static <T> List<T> innerJoin(List<List<T>> list, BiFunction<T, T, T> function) {
        if (list == null || function == null) {
            throw new NullPointerException("list or function must not be null");
        }
        if (list.isEmpty()) {
            return Collections.emptyList();
        }
        if (list.size() == 1) {
            return list.get(0);
        }

        List<List<T>> result = innerJoin(list.get(0), list.get(1), function);
        if (list.size() == 2) {
            return merge(result);
        } else {
            for (int i = 2; i < list.size(); i++) {
                List<T> l1 = list.get(i);
                List<List<T>> temp = new ArrayList<>();
                result.stream().forEach(l -> temp.addAll(innerJoin(l, l1, function)));
                result = temp;
            }
            return merge(result);
        }
    }
691047
private void eatRange(List list) {
        Token token0 = tokenizer.peekToken(0);
        Token token1 = tokenizer.peekToken(1);
        if (token0 == null) {// ∈
            return;
        }
        if (token1 != null && token1.getKind() == TokenKind.TO) {
            if (token0.getKind() == TokenKind.LITERAL_INT) {
                Token token2 = tokenizer.nextToken(2, TokenKind.LITERAL_INT);
                InnerRange range = new InnerRange(true, Integer.parseInt(token0.getData()),
                                                  Integer.parseInt(token2.getData()));
                list.add(range);
            } else if (token0.getKind() == TokenKind.LITERAL_LOWER_CHAR) {
                Token token2 = tokenizer.nextToken(2, TokenKind.LITERAL_LOWER_CHAR);
                InnerRange range = new InnerRange(false, token0.getData().charAt(0), token2.getData().charAt(0));
                list.add(range);
            } else if (token0.getKind() == TokenKind.LITERAL_UPPER_CHAR) {
                Token token2 = tokenizer.nextToken(2, TokenKind.LITERAL_UPPER_CHAR);
                InnerRange range = new InnerRange(false, token0.getData().charAt(0), token2.getData().charAt(0));
                list.add(range);
            } else {
                tokenizer.peekToken(0, TokenKind.LITERAL_INT, TokenKind.LITERAL_LOWER_CHAR,
                                    TokenKind.LITERAL_UPPER_CHAR);
            }
        } else if (token0.getKind() == TokenKind.LITERAL_INT) {
            list.add(Integer.parseInt(token0.getData()));
        } else if (token0.getKind() == TokenKind.LITERAL_DOUBLE) {
            list.add(Double.parseDouble(token0.getData()));
        } else if (token0.getKind() == TokenKind.LITERAL_STRING || token0.getKind() == TokenKind.LITERAL_LOWER_CHAR
                   || token0.getKind() == TokenKind.LITERAL_UPPER_CHAR) {
            list.add(token0.getData());
        } else {
            return;
        }
        Token token = tokenizer.nextToken();
        if (token != null && token.getKind() == TokenKind.COMMA) {
            tokenizer.nextToken();
            eatRange(list);
        }
    }
21033
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty){
		if(isTrim){
			part = StrUtil.trim(part);
		}
		if(false == ignoreEmpty || false == part.isEmpty()){
			list.add(part);
		}
		return list;
	}
1193430
public Tuple mapValues(@NonNull Function<Object, ? extends Object> function) {
      return NTuple.of(Arrays.stream(array()).map(function).collect(Collectors.toList()));
   }
1006869
private static <T> T firstOf(final List<T> list) {
        return list.isEmpty()? null: list.get(0);
    }
1170638
function(list, type) {
            if (!isArray(list.value))
                return list;

            function flatten_(list) {
                return list.reduce(function(a, b) {
                    return a.concat(isArray(b.value)
                        ? flatten_(b.value) : b);
                }, []);
            }

            // TODO: should not it try to determine the default return type by the type
            // of the input list top dimension? (for consistency with `cat`?)

            var ReturnType = type ? {
                comma: Value,
                space: Expression,
                ",":   Value,
                " ":   Expression
            }[type.value] : Value;

            if (!ReturnType) throw {
                type:    "Argument",
                message: "invalid `" + type.toCSS()
                    + "` delimiter. Expected `comma`, `space`, `,` or ` `\n"
            };

            return new ReturnType(flatten_(list.value));
        }
481428
function toArray (list, start) {
  start = start || 0;
  let i = list.length - start;
  const ret = new Array(i);
  while (i--) {
    ret[i] = list[i + start];
  }
  return ret
}
469940
def n_list(self, node):
        
        p = self.prec
        self.prec = 100
        lastnode = node.pop()
        lastnodetype = lastnode.kind

        # If this build list is inside a CALL_FUNCTION_VAR,
        # then the first * has already been printed.
        # Until I have a better way to check for CALL_FUNCTION_VAR,
        # will assume that if the text ends in *.
        last_was_star = self.f.getvalue().endswith('*')

        if lastnodetype.endswith('UNPACK'):
            # FIXME: need to handle range of BUILD_LIST_UNPACK
            have_star = True
            # endchar = ''
        else:
            have_star = False

        if lastnodetype.startswith('BUILD_LIST'):
            self.write('['); endchar = ']'
        elif lastnodetype.startswith('BUILD_TUPLE'):
            # Tuples can appear places that can NOT
            # have parenthesis around them, like array
            # subscripts. We check for that by seeing
            # if a tuple item is some sort of slice.
            no_parens = False
            for n in node:
                if n == 'expr' and n[0].kind.startswith('build_slice'):
                    no_parens = True
                    break
                pass
            if no_parens:
                endchar = ''
            else:
                self.write('('); endchar = ')'
                pass

        elif lastnodetype.startswith('BUILD_SET'):
            self.write('{'); endchar = '}'
        elif lastnodetype.startswith('BUILD_MAP_UNPACK'):
            self.write('{*'); endchar = '}'
        elif lastnodetype.startswith('ROT_TWO'):
            self.write('('); endchar = ')'
        else:
            raise TypeError('Internal Error: n_build_list expects list, tuple, set, or unpack')

        flat_elems = flatten_list(node)

        self.indent_more(INDENT_PER_LEVEL)
        sep = ''
        for elem in flat_elems:
            if elem in ('ROT_THREE', 'EXTENDED_ARG'):
                continue
            assert elem == 'expr'
            line_number = self.line_number
            value = self.traverse(elem)
            if line_number != self.line_number:
                sep += '\n' + self.indent + INDENT_PER_LEVEL[:-1]
            else:
                if sep != '': sep += ' '
            if not last_was_star:
                if have_star:
                    sep += '*'
                    pass
                pass
            else:
                last_was_star = False
            self.write(sep, value)
            sep = ','
        if lastnode.attr == 1 and lastnodetype.startswith('BUILD_TUPLE'):
            self.write(',')
        self.write(endchar)
        self.indent_less(INDENT_PER_LEVEL)

        self.prec = p
        self.prune()
        return
727625
public static String listToJson(List<?> list) {
        JSONArray array = new JSONArray();
        if (Checker.isNotEmpty(list)) {
            array.addAll(list);
        }
        return formatJson(array.toString());
    }
58305
public static <T> List<T> coerceNullToEmpty(List<T> list) {
    return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
  }
229215
public static Array listToArray(String list, char delimiter) {
	if (list.length() == 0) return new ArrayImpl();
	int len = list.length();
	int last = 0;

	Array array = new ArrayImpl();
	try {
	    for (int i = 0; i < len; i++) {
		if (list.charAt(i) == delimiter) {
		    array.append(list.substring(last, i));
		    last = i + 1;
		}
	    }
	    if (last <= len) array.append(list.substring(last));
	}
	catch (PageException e) {}
	return array;
    }
280500
function processListItems(list_str) {

        listLevel++;

        list_str = list_str.replace(/\n{2,}$/,"\n");
        list_str += "~0";

        list_str = list_str.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm, function(wholeMatch,m1,m2,m3,m4){

            var item = m4;
            var leading_line = m1;
            var leading_space = m2;

            if (leading_line || (item.search(/\n{2,}/)>-1)) {
                item = runBlockGamut(outdent(item));
            }
            else {
                item = doLists(outdent(item));
                item = item.replace(/\n$/,"");
                item = runSpanGamut(item);
            }

            return  "<li>" + item + "</li>\n";
        });

        list_str = list_str.replace(/~0/g,"");
        listLevel--;

        return list_str;
    }
1092760
@Override
    public C.List<T> prepend(C.List<T> list) {
        return prependList(list);
    }
1082460
function(list) {
            if (isArray(list.value)) {
                list.value = list.value.reverse();
            }

            return list;
        }
274865
function each(list, fn) {
  var len = list ? list.length : 0;
  var i = 0;
  for (; i < len; ++i) {
    fn(list[i], i);
  }
  return list
}
245905
protected <T> List<T> toArrayList(List<T> list) {
        if (list == null) {
            return null;
        }
        if (!list.getClass().equals(ArrayList.class)) {
            list = new ArrayList<>(list);
        }
        return list;
    }
1085351
function(list) {
            if (!isArray(list.value))
                return list;

            var listType, row, rowType;
            rowType  = list.type;
            list     = list.value;
            listType = list[0].type;
            row      = list[0].value;

            list = (isArray(row) ? row : [row]).map(function(col, i) {
                return newLessList(list.map(function(row) {
                    return (isArray(row.value)
                        ? row.value : [row])[i]
                            || new Node();
                }), rowType);
            });

            return newLessList(list, listType);
        }