Example usage for java.lang String join

List of usage examples for java.lang String join

Introduction

In this page you can find the example usage for java.lang String join.

Prototype

public static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements) 

Source Link

Document

Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter .

Usage

From source file:com.twosigma.beakerx.groovy.evaluator.GroovyClassLoaderFactory.java

public static GroovyClassLoader newEvaluator(Imports imports, Classpath classpath, String outDir,
        ImportCustomizer icz, ClassLoader parent) {

    try {//from  w  ww .ja v a2  s .  com
        Class.forName("org.codehaus.groovy.control.customizers.ImportCustomizer");
    } catch (ClassNotFoundException e1) {
        String gjp = System.getenv(GROOVY_JAR_PATH);
        String errorMsg = null;
        if (gjp != null && !gjp.isEmpty()) {
            errorMsg = "Groovy libary not found, GROOVY_JAR_PATH = " + gjp;
        } else {
            errorMsg = "Default groovy libary not found. No GROOVY_JAR_PATH variable set.";
        }
        throw new GroovyNotFoundException(errorMsg);
    }

    icz = addImportsCustomizer(icz, imports);
    CompilerConfiguration config = new CompilerConfiguration().addCompilationCustomizers(icz);
    String acloader_cp = String.join(File.pathSeparatorChar + "", classpath.getPathsAsStrings());
    config.setClasspath(acloader_cp);
    return new GroovyClassLoader(parent, config);
}

From source file:com.epam.dlab.backendapi.core.commands.PythonCommand.java

@Override
public String toCMD() {
    return PYTHON + fileName + StringUtils.SPACE + String.join(StringUtils.SPACE, options);
}

From source file:com.jayway.restassured.module.mockmvc.http.MultiValueController.java

@RequestMapping(value = "/multiValueParam", method = { POST, GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody String multiValueParam(@RequestParam("list") List<String> listValues) {
    return "{ \"list\" : \"" + String.join(",", listValues) + "\" }";
}

From source file:io.rhiot.utils.process.ExecProcessManager.java

@Override
public List<String> executeAndJoinOutput(String... command) {

    CommandLine cmdLine = CommandLine.parse(String.join(" ", command));
    DefaultExecutor executor = new DefaultExecutor();
    executor.setExitValue(0);/*w  w  w.j av a 2  s .  co  m*/
    ExecResultHandler resultHandler = null;

    if (getTimeout() > 0) {
        ExecuteWatchdog watchdog = new ExecuteWatchdog(getTimeout());
        executor.setWatchdog(watchdog);
        resultHandler = new ExecResultHandler(watchdog);
    }
    try {
        CollectingLogOutputStream outAndErr = new CollectingLogOutputStream();
        executor.setStreamHandler(new PumpStreamHandler(outAndErr));
        if (resultHandler != null) {
            executor.execute(cmdLine, resultHandler);
        } else {
            executor.execute(cmdLine);
        }
        resultHandler.waitFor();
        return outAndErr.getLines();

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.blackducksoftware.integration.hub.detect.detector.clang.CompileCommand.java

public String getCommand() {
    if (StringUtils.isNotBlank(rawCompileCommand.command)) {
        return rawCompileCommand.command;
    } else {//from   w ww.  j a v a 2  s. c  o m
        return String.join(" ", rawCompileCommand.arguments);
    }

}

From source file:com.netflix.spinnaker.clouddriver.kubernetes.v2.validator.KubernetesValidationUtil.java

private String joinAttributeChain(String... attributes) {
    List<String> chain = new ArrayList<>();
    chain.add(context);/*from  w  ww .j  av  a  2 s  .co  m*/
    Collections.addAll(chain, attributes);
    return String.join(".", chain);
}

From source file:edu.umd.umiacs.clip.tools.lang.TFIDFVector.java

@Override
public String toString() {
    return String.join(" | ",
            termToTFIDF.entrySet().stream().sorted((e1, e2) -> compare(e2.getValue(), e1.getValue())).limit(10)
                    .map(e -> e.getKey() + " -> " + (round(e.getValue() * 100.0d) / 100.0d)).collect(toList()));
}

From source file:io.github.dustalov.maxmax.Application.java

private static void write(String filename, MaxMax<String> maxmax) throws IOException {
    try (final BufferedWriter writer = Files.newBufferedWriter(Paths.get(filename))) {
        int i = 0;
        for (final Set<String> cluster : maxmax.getClusters()) {
            writer.write(String.format(Locale.ROOT, "%d\t%d\t%s\n", i++, cluster.size(),
                    String.join(", ", cluster)));
        }//from   w  w  w. ja v a  2s. c o m
    }
}

From source file:MyClass.java

public static String getClassInterfaces(Class c) {
    Class[] interfaces = c.getInterfaces();
    String interfacesList = null;
    if (interfaces.length > 0) {
        String[] interfaceNames = new String[interfaces.length];
        for (int i = 0; i < interfaces.length; i++) {
            interfaceNames[i] = interfaces[i].getSimpleName();
        }/* ww  w  .ja v  a2  s  .c  om*/
        interfacesList = String.join(", ", interfaceNames);
    }
    return interfacesList;
}