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.eclipse.rdf4j.sail.lucene.LuceneQuery.java
@Override @Deprecated/*w w w. j a va 2 s . c o m*/ public Iterable<? extends DocumentScore> query(Resource resource) throws IOException { TopDocs docs; if (resource != null) { docs = index.search(resource, query); } else { docs = index.search(query); } return Iterables.transform(Arrays.asList(docs.scoreDocs), new Function<ScoreDoc, DocumentScore>() { @Override public DocumentScore apply(ScoreDoc doc) { return new LuceneDocumentScore(doc, highlighter, index); } }); }
From source file:com.facebook.buck.cxx.platform.WindowsPreprocessor.java
@Override public Iterable<String> systemIncludeArgs(Iterable<String> includeRoots) { return Iterables.transform(includeRoots, prependIncludeFlag); }
From source file:controllers.DocumentsController.java
public static Result list(UUID collection) { return ok(Json.toJson(Lists.newArrayList( Iterables.transform(fetchDocumentIds(collection), UuidUtils.uuidToStringFunction())))); }
From source file:org.polarsys.reqcycle.traceability.types.configuration.typeconfiguration.util.ConfigUtils.java
public static Iterable<CustomType> getCustomTypesUsedInRelations(Configuration config, final String typeId) { return Sets.newHashSet(Iterables .concat(Iterables.transform(config.getRelations(), new Function<Relation, Iterable<CustomType>>() { public Iterable<CustomType> apply(Relation r) { List<CustomType> result = new LinkedList<CustomType>(); if (r.getDownstreamType() instanceof CustomType) { CustomType downstreamType = (CustomType) r.getDownstreamType(); if (downstreamType.getSuperType().getTypeId().equals(typeId)) { result.add(downstreamType); }/*w w w . ja va 2s. co m*/ } if (r.getUpstreamType() instanceof CustomType) { CustomType upstreamType = (CustomType) r.getUpstreamType(); if (upstreamType.getSuperType().getTypeId().equals(typeId)) { result.add(upstreamType); } } return result; } }))); }
From source file:com.facebook.buck.parser.JavaTestBuildRuleFactory.java
@Override protected void amendBuilder(AbstractBuildRuleBuilder abstractBuilder, BuildRuleFactoryParams params) throws NoSuchBuildTargetException { JavaTestRule.Builder builder = ((JavaTestRule.Builder) abstractBuilder); JavaLibraryBuildRuleFactory.extractAnnotationProcessorParameters(builder.getAnnotationProcessingBuilder(), builder, params);/* w w w . ja v a 2 s . com*/ // vm_args builder.setVmArgs(params.getOptionalListAttribute("vm_args")); // source_under_test Function<String, String> contextualBuildParser = createBuildTargetParseFunction(params); ImmutableSet<String> sourceUnderTest = ImmutableSet.copyOf( Iterables.transform(params.getOptionalListAttribute("source_under_test"), contextualBuildParser)); builder.setSourceUnderTest(sourceUnderTest); }
From source file:uk.ac.stfc.isis.ibex.configserver.internal.IocNameFilterPredicate.java
private Iterable<String> normaliseEach(Collection<EditableIoc> toFilter) { return Iterables.transform(toFilter, new Function<EditableIoc, String>() { @Override//from w ww. j a va 2 s. c o m public String apply(EditableIoc ioc) { return normalise(ioc.getName()); } }); }
From source file:com.google.cloud.genomics.utils.Contig.java
/** * Parse the list of Contigs expressed in the string argument. * * The common use case is to parse the value of a command line parameter. * * @param contigsArgument - a string expressing the specified contiguous region(s) of the genome. * The format is chromosome:start:end[,chromosome:start:end] * @return a list of Contig objects// w w w. j a v a 2 s . c o m */ public static Iterable<Contig> parseContigsFromCommandLine(String contigsArgument) { return Iterables.transform(Splitter.on(",").split(contigsArgument), new Function<String, Contig>() { @Override public Contig apply(String contigString) { ArrayList<String> contigInfo = newArrayList(Splitter.on(":").split(contigString)); Long start = Long.valueOf(contigInfo.get(1)); Long end = Long.valueOf(contigInfo.get(2)); Preconditions.checkArgument(start <= end, "Contig coordinates are incorrectly specified: start " + start + " is greater than end " + end); return new Contig(contigInfo.get(0), start, end); } }); }
From source file:org.jclouds.vcloud.functions.CatalogItemsInOrg.java
@Override public Iterable<CatalogItem> apply(Org from) { return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from), new Function<Catalog, Iterable<? extends CatalogItem>>() { @Override/*from ww w . j a va 2 s . c o m*/ public Iterable<? extends CatalogItem> apply(Catalog from) { return allCatalogItemsInCatalog.apply(from); } })); }
From source file:org.eclipse.incquery.runtime.matchers.psystem.queries.PQueries.java
public static Function<PBody, Iterable<PQuery>> directlyReferencedQueriesFunction() { return new Function<PBody, Iterable<PQuery>>() { @Override//from w w w . java2 s .c o m public Iterable<PQuery> apply(PBody body) { return Iterables.transform(body.getConstraintsOfType(IQueryReference.class), PQueries.queryOfReferenceFunction()); } }; }
From source file:com.synflow.cx.internal.scheduler.path.Path.java
@Override public String toString() { return Joiner.on(", ").join(Iterables.transform(conds, new Function<Branch, String>() { @Override//w ww . j av a 2s . com public String apply(Branch cond) { CxExpression condition = cond.getCondition(); if (condition == null) { return "(else)"; } else { return new CxPrinter().toString(condition); } } })); }