Java List Join join(List command, List args)

Here you can find the source of join(List command, List args)

Description

join

License

Open Source License

Declaration

private static List<String> join(List<String> command, List<String> args) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    private static List<String> join(List<String> command, List<String> args) {
        try {//from w w  w.  j a  va2 s.  c o  m
            args.addAll(0, command);
            return args;
        } catch (Exception e) {
            ArrayList<String> commands = new ArrayList<String>(args.size() + command.size());
            commands.addAll(command);
            commands.addAll(args);
            return commands;
        }
    }

    static String join(List<String> runCommand, String del) {
        if (runCommand.size() == 0)
            return "";
        StringBuilder b = new StringBuilder(runCommand.get(0));
        for (int i = 1; i < runCommand.size(); ++i) {
            b.append(del).append(runCommand.get(i));
        }
        return b.toString();
    }
}

Related

  1. join(List list, String delim)
  2. join(List args, String connector)
  3. join(List args, String seperator)
  4. join(List array, String delim)
  5. join(List c, String seperator)
  6. join(List elements)
  7. join(List items, char separator)
  8. join(List l, String joiner)
  9. join(List lines, char delim)

  10. HOME | Copyright © www.java2s.com 2016