List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:de.tudarmstadt.ukp.dkpro.tc.core.io.DumpDataWriter.java
@Override public void write(File outputDirectory, FeatureStore featureStore, boolean useDenseInstances, String learningMode, boolean applyWeighting) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(featureStore.getNumberOfInstances()); sb.append("\n"); sb.append(StringUtils.join(featureStore.getUniqueOutcomes(), ", ")); sb.append("\n"); for (Instance instance : featureStore.getInstances()) { sb.append(instance.toString());/*from ww w . ja va2 s. com*/ } System.out.println(sb.toString()); FileUtils.writeStringToFile(new File(outputDirectory, DUMP_FILE_NAME), sb.toString()); }
From source file:com.liferay.jenkins.tools.BetweenTimestampsMatcher.java
public BetweenTimestampsMatcher(String[] optionValues) { int length = optionValues.length; if (isEven(length)) { String start = StringUtils.join(Arrays.copyOfRange(optionValues, 0, length / 2), ' '); String end = StringUtils.join(Arrays.copyOfRange(optionValues, length / 2, length), ' '); String[] args = new String[2]; setTimestamps(parseTimestamp(start), parseTimestamp(end)); } else {//from w w w. j a v a 2 s .c o m throw new IllegalArgumentException("between option require even number of parameters"); } }
From source file:com.redhat.red.build.koji.model.xmlrpc.messages.ListTagsRequestTest.java
@Test public void verifyVsCapturedHttpRequest() throws Exception { EventStreamParserImpl eventParser = new EventStreamParserImpl(); bindery.render(eventParser, new ListTagsRequest(new KojiTagQuery(422953))); List<Event<?>> objectEvents = eventParser.getEvents(); System.out.printf("Got Events:\nSTART\n %s\nEND", StringUtils.join(objectEvents, "\n ")); eventParser.clearEvents();/*from www.ja va 2s . c om*/ List<Event<?>> capturedEvents = parseEvents("listTags-byBuildId-request.xml"); assertEquals(objectEvents, capturedEvents); }
From source file:com.incapture.slate.model.node.description.table.TableSeparatorNode.java
@Override public String getContent() { return StringUtils.join(separators, " | "); }
From source file:de.elatexam.editor.components.panels.tasks.mapping.CorrectAssignementConverter.java
public String convertToString(final Object value, final Locale locale) { final List<String> list = (List<String>) value; return StringUtils.join(list.iterator(), ","); }
From source file:com.github.mhendred.face4j.Credentials.java
public String getAuthString() { if (isEmpty()) { return null; }//from ww w.jav a 2 s. c o m vals.clear(); for (String key : params.keySet()) { vals.add(key + ":" + params.get(key)); } return StringUtils.join(vals, ","); }
From source file:br.com.Summoner.core.base.cartas.monk.MonkCard.java
@Override public long CalculaBonus(Jogada jogada, List<Card> listaMonstrosAdversarios) { List<Card> cartasUtilizadasCombo = jogada.CartasUtilizadas.stream() .filter(carta -> carta.TipoCarta == TipoCarta.Item && carta.TipoMonstro == TipoMonstro.Monk) .collect(Collectors.toList()); MonkComboResult comboResult = new MonkComboResult(); long forcaBonus = 0; if (cartasUtilizadasCombo.size() > 0) { String[] golpesCombo = cartasUtilizadasCombo .stream().map(carta -> ((MonkItemCard) carta).Golpes.stream() .map(golpe -> golpe.tipoGolpe.toString()).collect(Collectors.joining())) .collect(Collectors.joining()).split(""); Arrays.sort(golpesCombo); String comboRealizado = StringUtils.join(Arrays.asList(golpesCombo), ""); comboResult.ComboRealizado = comboRealizado; // comboResult.CombosCarta.addAll(this.Combos); for (int i = 0; i < this.Combos.size(); i++) { MonkMonsterCombo combo = this.Combos.get(i); char[] criaturaCombo = combo.CombinacaoCombo.toCharArray(); Arrays.sort(criaturaCombo); String comboDaCriatura = new String(criaturaCombo); boolean encontrou = comboRealizado.contains(comboDaCriatura); if (encontrou && forcaBonus < combo.DanoCombo) { forcaBonus = combo.DanoCombo; comboResult.ValorComboRealizado = forcaBonus; comboResult.ComboCriatura = comboDaCriatura; }// w w w . j ava2s. com } CombosRealizados.add(comboResult); } return forcaBonus; }
From source file:com.dilipkumarg.qb.UpdateQueryBuilder.java
protected String buildArgumentsQueryString() { List<String> columns = Lists.newArrayList(); for (TableColumn arg : getArguments().keySet()) { columns.add(arg.getFieldName() + "=" + PLACE_HOLDER); }// ww w . ja v a2s . c om return StringUtils.join(columns, SEPARATOR); }
From source file:com.github.hexocraft.random.items.command.RiCommandCreate.java
public RiCommandCreate(RandomItemsPlugin plugin) { super("create", plugin); this.setAliases(Lists.newArrayList("c")); this.setDescription(StringUtils.join(plugin.messages.cCreate, "\n")); this.setPermission(Permissions.CREATE.toString()); this.addArgument(new CommandArgument<String>("name", ArgTypeString.get(), true, true, plugin.messages.cCreateArgName)); }
From source file:com.mobiquitynetworks.statsutilspig.GetKeys.java
@Override public String exec(Tuple params) throws IOException { DataBag keysDictionary = (DataBag) params.get(0); String[] keys = new String[Ints.checkedCast(keysDictionary.size())]; int counter = 0; for (Object obj : keysDictionary) { Tuple iterTup = (Tuple) obj;//from ww w .j av a 2 s . c o m Map<String, String> iterMap = (Map) iterTup.get(0); keys[counter] = iterMap.get("real"); counter++; } return StringUtils.join(keys, ","); }