List of usage examples for com.google.common.collect Iterables transform
@CheckReturnValue public static <F, T> Iterable<T> transform(final Iterable<F> fromIterable, final Function<? super F, ? extends T> function)
From source file:org.apache.isis.viewer.restfulobjects.rendering.util.FollowSpecUtil.java
public final static List<List<PathNode>> asFollowSpecs(final List<List<String>> links) { return Lists.newArrayList(Iterables.transform(links, new Function<List<String>, List<PathNode>>() { @Override/*www. jav a 2 s . c om*/ public List<PathNode> apply(List<String> pathParts) { return Lists.newArrayList(Iterables.transform(pathParts, new Function<String, PathNode>() { @Override public PathNode apply(String input) { return PathNode.parse(input); } })); } })); }
From source file:com.facebook.buck.rules.args.AbstractStringArg.java
public static Iterable<Arg> from(Iterable<String> args) { return Iterables.transform(args, StringArg::of); }
From source file:org.graylog.collector.config.ConfigurationUtils.java
public static String toString(Configuration configurationObject, Object nameClass) { final Map<String, String> values = configurationObject.toStringValues(); final Iterable<String> strings = Iterables.transform(values.entrySet(), new Function<Map.Entry<String, String>, String>() { @Nullable//from w w w . java 2 s . c o m @Override public String apply(@Nullable Map.Entry<String, String> input) { if (input == null) { return ""; } return String.format(Locale.getDefault(), "%s='%s'", input.getKey(), input.getValue()); } }); final StringBuffer sb = new StringBuffer(nameClass.getClass().getSimpleName()); sb.append('{'); sb.append(Joiner.on(", ").join(strings)); sb.append('}'); return sb.toString(); }
From source file:com.google.devtools.build.lib.analysis.platform.PlatformProviderUtils.java
/** Retrieves and casts {@link PlatformInfo} providers from the given targets. */ public static Iterable<PlatformInfo> platforms(Iterable<? extends SkylarkProviderCollection> targets) { return Iterables.transform(targets, PlatformProviderUtils::platform); }
From source file:com.ning.billing.invoice.dao.InvoiceModelDaoHelper.java
public static BigDecimal getBalance(final InvoiceModelDao invoiceModelDao) { return InvoiceCalculatorUtils.computeInvoiceBalance(Iterables.transform(invoiceModelDao.getInvoiceItems(), new Function<InvoiceItemModelDao, InvoiceItem>() { @Override/*from w ww . j ava 2 s.c o m*/ public InvoiceItem apply(final InvoiceItemModelDao input) { return InvoiceItemFactory.fromModelDao(input); } }), Iterables.transform(invoiceModelDao.getInvoicePayments(), new Function<InvoicePaymentModelDao, InvoicePayment>() { @Nullable @Override public InvoicePayment apply(final InvoicePaymentModelDao input) { return new DefaultInvoicePayment(input); } })); }
From source file:org.fcrepo.audit.AuditUtils.java
/** * Returns the comma event types string for the integer event types. * * @param types//from w w w.j a va2s.co m * @return */ public static String getEventURIs(final Set<Integer> types) { final String uris = Joiner.on(',').join(Iterables.transform(types, new Function<Integer, String>() { @Override public String apply(final Integer type) { return AuditNamespaces.REPOSITORY + EventType.valueOf(type); } })); LOGGER.debug("Constructed event type URIs: {}", uris); return uris; }
From source file:com.google.gerrit.server.plugins.MultipleProvidersForPluginException.java
private static String providersListToString(Iterable<ServerPluginProvider> providersHandlers) { Iterable<String> providerNames = Iterables.transform(providersHandlers, new Function<ServerPluginProvider, String>() { @Override//from w ww . java 2 s. com public String apply(ServerPluginProvider provider) { return provider.getProviderPluginName(); } }); return Joiner.on(", ").join(providerNames); }
From source file:org.apache.isis.applib.util.Enums.java
public static String getFriendlyNameOf(String anEnumName) { return Joiner.on(" ") .join(Iterables.transform(Splitter.on("_").split(anEnumName), LOWER_CASE_THEN_CAPITALIZE)); }
From source file:org.polarsys.reqcycle.repository.connector.update.ValidateUriConnector.java
private static Set<String> loadExtensions() { final IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor("org.eclipse.emf.ecore", "extension_parser"); HashSet<String> set = Sets.newHashSet( Iterables.transform(Arrays.asList(elements), new Function<IConfigurationElement, String>() { @Override//from ww w . j av a 2 s .c o m public String apply(IConfigurationElement arg0) { return arg0.getAttribute("type").toLowerCase(); } })); set.add("xmi"); return set; }
From source file:io.druid.java.util.common.io.smoosh.Smoosh.java
public static Map<String, File> smoosh(File inDir, File outDir) throws IOException { final List<File> files = Arrays.asList(inDir.listFiles()); return smoosh(inDir, outDir, Utils.zipMap(Iterables.transform(files, new Function<File, String>() { @Override//from w w w.java2s . c o m public String apply(File input) { return input.getName(); } }), files)); }