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:com.genuitec.eclipse.gerrit.tools.internal.gps.GpsQuickImportFiles.java
private static void store() { prefs.put("quick-files", StringUtils.join(files, '\n')); //$NON-NLS-1$ try {//from w w w .jav a2s .c o m prefs.flush(); } catch (BackingStoreException e) { GerritToolsPlugin.getDefault().log(e); } }
From source file:com.dubture.composer.ui.converter.License2StringConverter.java
@Override public String convert(Object fromObject) { ArrayList<String> list = new ArrayList<String>(); License licenses = (License) fromObject; for (String license : licenses) { list.add(license);/* w w w.j a v a2s. c om*/ } if (list.size() == 0) { return ""; } return StringUtils.join(list.toArray(), ", "); }
From source file:ml.shifu.shifu.core.binning.DynamicBinningTest.java
public static List<NumBinInfo> createNumBinInfos(int binCnt) { Random rd = new Random(System.currentTimeMillis()); List<Double> thresholds = new ArrayList<Double>(binCnt - 1); for (int i = 0; i < binCnt - 1; i++) { thresholds.add(rd.nextGaussian() * 200); }//ww w . ja va2 s .c om Collections.sort(thresholds); List<NumBinInfo> binInfoList = NumBinInfo.constructNumBinfo(StringUtils.join(thresholds, ':'), ':'); for (NumBinInfo binInfo : binInfoList) { if (rd.nextDouble() > 0.45) { int total = rd.nextInt() % 1000; int positive = (int) (total * rd.nextDouble()); binInfo.setTotalInstCnt(total); binInfo.setPositiveInstCnt(positive); } } return binInfoList; }
From source file:fit.testFxtr.HandleFixtureDoesNotExtendFixtureTest.java
@Test public void testLearnHowBadFixtureClassIsHandled() throws Exception { List<String> tableLines = Arrays.asList(new String[] { "<table>", " <tr>", " <td>fit.testFxtr.WouldBeFixture</td>", " </tr>", "</table>" }); String tableText = StringUtils.join(tableLines, "\r\n"); Parse tableForFaultyFixture = new Parse(tableText); new Fixture().doTables(tableForFaultyFixture); String fixtureClassCellText = tableForFaultyFixture.at(0, 0, 0).body; assertEquals("fit.testFxtr.WouldBeFixture<hr/> " + "<span class=\"fit_label\">" + "Class fit.testFxtr.WouldBeFixture is not a fixture." + "</span>", fixtureClassCellText); }
From source file:com.framework.infrastructure.utils.StringUtilsTest.java
@Test public void utilsByApache() { //join// w w w . j a v a 2s . c o m List<String> inputList = Lists.newArrayList("a", "b", "c"); String result = StringUtils.join(inputList, ","); Assert.assertEquals("a,b,c", result); Assert.assertEquals("001", StringUtils.leftPad("1", 3, "0")); }
From source file:de.suljee.dw.whenthendowhen.PsiUtils.java
public static String joinExpressionTexts(List<PsiExpression> psiExpressions, String separator) { Collection<String> mockedMethodArgs = CollectionUtils.collect(psiExpressions, EXPRESSION_TO_TEXT_TRANSFORMER); return StringUtils.join(mockedMethodArgs, separator); }
From source file:com.alibaba.otter.shared.arbitrate.impl.config.ArbitrateConfigUtils.java
/** * ?Nodezk?//from www. j ava 2 s . co m */ public static List<String> getServerAddrs() { Node node = ArbitrateConfigRegistry.getConfig().currentNode(); if (node != null) { String addr = StringUtils.join(node.getParameters().getZkCluster().getServerList(), ','); return Arrays.asList(addr); } else { return new ArrayList<String>(); } }
From source file:me.Laubi.MineMaze.SubCommands.java
@SubCommand(alias = "help", console = true, permission = "worldedit.minemaze.help", author = "Laubi", description = "You need help? Here you get it!") public static void help(LocalPlayer player, CommandHandler handler, MineMazePlugin plugin) { Iterator<Method> it = plugin.getSubCommands().iterator(); player.print("All registrated subcommands:"); while (it.hasNext()) { SubCommand cur = it.next().getAnnotation(SubCommand.class); String msg = " 9%1: a: %2"; msg = msg.replace("%1", StringUtils.join(cur.alias(), "|")).replace("%2", cur.description()); player.print(msg);/*ww w. j a va2 s . c om*/ } }
From source file:com.gooddata.util.TagsSerializer.java
@Override public void serialize(Set<String> set, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeString(StringUtils.join(set, " ")); }
From source file:com.alexholmes.hadooputils.combine.seqfile.mapred.CombineSequenceFileJob.java
/** * Print the usage.//from w ww.ja v a2s .c o m * * @return the Java exit code */ static int printUsage() { System.out.println(StringUtils.join(USAGE, "\n")); ToolRunner.printGenericCommandUsage(System.out); return -1; }