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:eu.over9000.cathode.data.parameters.StreamsQuery.java

@Override
public List<NameValuePair> buildParamPairs() {
    final List<NameValuePair> result = new ArrayList<>();

    if (game != null) {
        result.add(new BasicNameValuePair("game", game));
    }//from   w  ww .j a  v  a 2 s  .  c om
    if (channels != null && !channels.isEmpty()) {
        result.add(new BasicNameValuePair("channel", String.join(",", channels)));
    }
    if (clientId != null) {
        result.add(new BasicNameValuePair("client_id", clientId));
    }
    if (streamType != null) {
        result.add(new BasicNameValuePair("stream_typ=", streamType.name()));
    }

    return result;
}

From source file:zipkin.execjar.ExecJarRule.java

/** Returns stderr and stdout dumped into the same place */
public String consoleOutput() {
    return String.join("\n", console);
}

From source file:am.ik.categolj3.api.category.InMemoryCategoryService.java

@Override
public List<List<String>> findAllOrderByNameAsc() {
    return this.categories.values().stream().distinct()
            .sorted(Comparator.comparing(categories -> String.join(",", categories)))
            .collect(Collectors.toList());
}

From source file:MyClass.java

public static String getGenericTypeParams(Class c) {
    StringBuilder sb = new StringBuilder();
    TypeVariable<?>[] typeParms = c.getTypeParameters();

    if (typeParms.length > 0) {
        String[] paramNames = new String[typeParms.length];
        for (int i = 0; i < typeParms.length; i++) {
            paramNames[i] = typeParms[i].getTypeName();
        }//  ww w  . j a  v  a  2  s.  c  o m
        sb.append('<');
        String parmsList = String.join(",", paramNames);
        sb.append(parmsList);
        sb.append('>');
    }
    return sb.toString();
}

From source file:com.videaps.cube.solving.access.SplitColorsDelegate.java

public void execute(DelegateExecution execution) throws Exception {
    logger.info(execution.getCurrentActivityName());

    @SuppressWarnings("unchecked")
    List<String> brickColorsInner = (List<String>) execution.getVariable("brickColorsInner");

    StringBuffer colorBuf = new StringBuffer();
    ColorPicker colorPicker = new ColorPicker();

    int partitionSize = brickColorsInner.size() / ColorPicker.NO_OF_BRICKS_PER_FACE;
    logger.info("partitionSize=" + partitionSize);
    List<List<String>> partitions = ListUtils.partition(brickColorsInner, partitionSize);
    for (List<String> partition : partitions) {
        String colorStr = String.join("", partition);
        logger.info("colorStr=" + colorStr);
        String mostFrequentColor = colorPicker.mostFrequentColor(colorStr);
        logger.info("mostFrequentColor=" + mostFrequentColor);
        colorBuf.append(mostFrequentColor);
    }//from  w  w w  .  ja  v a  2  s .co  m

    execution.setVariable("brickColorsSplit", colorBuf.toString());
    logger.info("brickColorsSplit=" + colorBuf.toString());
}

From source file:com.khartec.waltz.web.WebUtilities.java

/**
 * Given a vararg/array of path segments will join them
 * to make a string representing the path.  No starting or trailing
 * slashes are added to the resultant path string.
 *
 * @param segs Segments to join/*from w  w  w  . j av  a2s.  co m*/
 * @return String representing the path produced by joining the segments
 * @throws IllegalArgumentException If any of the segments are null
 */
public static String mkPath(String... segs) {
    checkAll(segs, x -> StringUtilities.notEmpty(x), "Cannot convert empty segments to path");

    return String.join("/", segs);
}

From source file:com.articulate.sigma.nlp.CorefSubstitutorLargeTest.java

@Test
public void test() {
    Annotation document = Pipeline.toAnnotation(input);

    CorefSubstitutor ps = new CorefSubstitutor(document);

    SentenceBuilder sb = new SentenceBuilder(document);
    String actual = String.join(" ", sb.asStrings(ps));
    assertEquals(expected, actual);//from   ww w . j ava2  s .com
}

From source file:net.sf.jabref.sql.SQLUtil.java

/**
 * @return Create a common separated field names
 *///from   w  ww.  j a v  a2 s.com
public static String getFieldStr() {
    // create comma separated list of field names
    List<String> fieldNames = new ArrayList<>();
    for (int i = 0; i < SQLUtil.getAllFields().size(); i++) {
        StringBuilder field = new StringBuilder(SQLUtil.allFields.get(i));
        if (SQLUtil.RESERVED_DB_WORDS.contains(field.toString())) {
            field.append('_');
        }
        fieldNames.add(field.toString());
    }
    return String.join(", ", fieldNames);
}

From source file:com.baifendian.swordfish.execserver.engine.hive.HiveUtil.java

/**
 * ORC/*from w w w.ja  v  a 2 s  . com*/
 */
public static String getORCTmpTableDDL(String dbName, String tableName, List<HqlColumn> hqlColumnList,
        String localtion) {
    List<String> fieldList = new ArrayList<>();

    for (HqlColumn hqlColumn : hqlColumnList) {
        fieldList.add(MessageFormat.format("{0} {1}", hqlColumn.getName(), hqlColumn.getType()));
    }

    String sql = "CREATE TEMPORARY EXTERNAL TABLE {0}.{1}({2}) STORED AS orc LOCATION \"{3}\"";

    sql = MessageFormat.format(sql, dbName, tableName, String.join(",", fieldList), localtion);

    return sql;
}

From source file:edu.umd.umiacs.clip.tools.classifier.LibSVMUtils.java

public static String asString(Map<Integer, Double> map) {
    return String.join(" ",
            map.entrySet().stream().sorted((e1, e2) -> Integer.compare(e1.getKey(), e2.getKey()))
                    .filter(entry -> entry.getValue() != 0)
                    .map(entry -> entry.getKey() + ":" + entry.getValue()).collect(toList()));
}