Example usage for org.apache.commons.lang StringUtils join

List of usage examples for org.apache.commons.lang StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils join.

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:com.xdtech.core.orm.utils.CollectionUtils.java

/**
 * ????(Getter), ??.//from  w w w  .j  a v a2  s.  co m
 * 
 * @param collection ???.
 * @param propertyName ??????.
 * @param separator .
 */
public static String extractElementPropertyToString(final Collection collection, final String propertyName,
        final String separator) {
    List list = extractElementPropertyToList(collection, propertyName);
    return StringUtils.join(list, separator);
}

From source file:com.hp.mqm.client.QueryHelper.java

public static String conditionIn(String name, Collection<?> ids, boolean isNumber) {
    if (isNumber) {
        return name + " IN " + StringUtils.join(ids, ",");
    } else {/*from   ww w. j a  v  a2s .  c  om*/
        //wrap values with '
        return name + " IN '" + StringUtils.join(ids, "','") + "'";
    }
}

From source file:edu.princeton.cs.introcs.diffutil.DiffUtilTest.java

@Test
public void testSomeMethod() {
    final List<String> diff = DiffUtil.getUnifiedDiff("go right\ngo up", "go right\ngo down\ndig");
    final String joinedList = StringUtils.join(diff.toArray(), "\n");
    System.out.println(joinedList);
    assertEquals("< go up\n> go down\n> dig", joinedList);
}

From source file:com.bigdata.dastor.streaming.StreamIn.java

/**
 * Request ranges to be transferred from source to local node
 *///from w ww . j a v  a  2 s .c o m
public static void requestRanges(InetAddress source, String tableName, Collection<Range> ranges) {
    if (logger.isDebugEnabled())
        logger.debug("Requesting from " + source + " ranges " + StringUtils.join(ranges, ", "));
    StreamRequestMetadata streamRequestMetadata = new StreamRequestMetadata(FBUtilities.getLocalAddress(),
            ranges, tableName);
    Message message = StreamRequestMessage
            .makeStreamRequestMessage(new StreamRequestMessage(streamRequestMetadata));
    MessagingService.instance.sendOneWay(message, source);
}

From source file:com.redhat.rhn.frontend.taglibs.RhnTagFunctions.java

/**
 * Joins an array of Strings into a comma-separated String
 *
 * @param array The array of Strings to join
 * @return String containing a comma-separated list
 *///  w  w w . j  a va 2 s .  c  o  m
public static String arrayToString(String[] array) {
    return StringUtils.join(array, ',');
}

From source file:mongodb.MongoUtils.java

public static void construct(Document doc, String attribut, Object valeur) {
    if (!attribut.contains(".")) {
        doc.append(attribut, valeur);//from  www. j a  va  2  s. c o  m
    } else {
        String[] parties = attribut.split("\\.");
        if (doc.get(parties[0]) == null)
            doc.append(parties[0], new Document());

        construct((Document) doc.get(parties[0]),
                StringUtils.join(Arrays.copyOfRange(parties, 1, parties.length), "."), valeur);
    }
}

From source file:net.darkmist.alib.str.StrUtil.java

/**
 * Join strings with a delimiter./*from w w w. ja v a2s . co m*/
 * @param delimiter The delimiter to use between strings.
 * @param strs The Strings to join.
 */
// not deprecated because this allows vargs
public static final String join(CharSequence delimiter, CharSequence... strs) {
    return StringUtils.join(strs, delimiter.toString());
}

From source file:de.mdstv.emergency2.Ticket.java

/**
 * Creates a new {@link Ticket} based on given data
 *
 * @param reporter The {@link Player} who reported the emergency
 * @param assignee The {@link Player} which got the ticket assigned
 * @param level The {@link EmergencyLevel} for this ticket
 * @param message The message for the {@link Ticket}
 * @return The generated {@link Ticket}//from  w w  w .j  a  v a  2  s . c o m
 */
public static Ticket createTicket(Player reporter, Player assignee, EmergencyLevel level, String... message) {
    String messageText = StringUtils.join(message, " ");

    Ticket ticket = new Ticket();
    ticket.reporter = reporter;
    ticket.assignee = assignee;
    ticket.level = level;
    ticket.loc = reporter.getLocation();
    ticket.message = messageText;

    return ticket;
}

From source file:de.tudarmstadt.ukp.dkpro.tc.core.feature.InstanceIdFeature.java

public static Feature retrieve(JCas jcas, TextClassificationUnit unit) {

    String fullId = DocumentMetaData.get(jcas).getDocumentId();
    String[] parts = fullId.split("_");
    fullId = StringUtils.join(Arrays.copyOfRange(parts, 0, parts.length - 1), "_");

    fullId = fullId + "_" + unit.getId();

    String suffix = unit.getSuffix();
    if (suffix != null && suffix.length() > 0) {
        fullId = fullId + "_" + suffix;
    }/*from   w  w  w.  j  a va  2  s. com*/

    return new Feature(ID_FEATURE_NAME, fullId);
}

From source file:com.microsoft.windowsazure.core.utils.CollectionStringBuilder.java

public static String join(List<String> values, String separator) {
    return StringUtils.join(values, separator);
}