Example usage for com.google.common.collect Lists transform

List of usage examples for com.google.common.collect Lists transform

Introduction

In this page you can find the example usage for com.google.common.collect Lists transform.

Prototype

@CheckReturnValue
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) 

Source Link

Document

Returns a list that applies function to each element of fromList .

Usage

From source file:org.sosy_lab.solver.basicimpl.AbstractQuantifiedFormulaManager.java

@Override
public final BooleanFormula forall(List<? extends Formula> pVariables, BooleanFormula pBody) {
    return wrap(forall(Lists.transform(pVariables, extractor), extractInfo(pBody)));
}

From source file:org.jasig.portlet.notice.service.jpa.NotificationDTOMapper.java

@Override
public List<JpaEntry> toJpaEntryList(List<EntryDTO> entries) {
    return Lists.transform(entries, new Function<EntryDTO, JpaEntry>() {
        @Override/*from  w w  w .j av a2  s .  c  o m*/
        public JpaEntry apply(EntryDTO entry) {
            return toJpaEntry(entry);
        }
    });
}

From source file:org.sonar.server.es.EsUtils.java

public static List<String> termsKeys(Terms terms) {
    return Lists.transform(terms.getBuckets(), new Function<Terms.Bucket, String>() {
        @Override/*w w w  . j a va 2 s.  c o m*/
        public String apply(Terms.Bucket bucket) {
            return bucket.getKeyAsString();
        }
    });
}

From source file:org.gradle.model.internal.registry.DefaultInputs.java

public List<ModelBinding<?>> getBindings() {
    return Lists.transform(inputs, new Function<ModelRuleInput<?>, ModelBinding<?>>() {
        public ModelBinding<?> apply(ModelRuleInput<?> input) {
            return input.getBinding();
        }//from  w ww .j  a  va  2  s .c  o m
    });
}

From source file:gobblin.metrics.metric.filter.MetricTypeFilter.java

public MetricTypeFilter(String allowedMetrics) {
    if (Strings.isNullOrEmpty(allowedMetrics)) {
        this.allowedMetrics = Lists.newArrayList(Metrics.values());
    } else {//  ww w  .  j a v a2s.co  m
        List<String> allowedMetricsList = Splitter.on(",").trimResults().omitEmptyStrings()
                .splitToList(allowedMetrics);
        this.allowedMetrics = Lists.transform(allowedMetricsList, new Function<String, Metrics>() {
            @Nullable
            @Override
            public Metrics apply(String input) {
                return input == null ? null : Metrics.valueOf(input);
            }
        });
    }
}

From source file:org.raml.jaxrs.generator.v10.V10GResource.java

public V10GResource(final V10TypeRegistry registry, final GAbstractionFactory factory, GResource parent,
        Resource resource) {/*from   w  ww.  j a  v  a 2s.  c om*/
    this.factory = factory;
    this.parent = parent;
    this.resource = resource;
    this.subResources = Lists.transform(resource.resources(), new Function<Resource, GResource>() {

        @Nullable
        @Override
        public GResource apply(@Nullable Resource input) {

            return factory.newResource(registry, V10GResource.this, input);
        }
    });

    this.uriParameters = Lists.transform(resource.uriParameters(), new Function<TypeDeclaration, GParameter>() {

        @Nullable
        @Override
        public GParameter apply(@Nullable TypeDeclaration input) {
            return new V10PGParameter(registry, input);
        }
    });

    this.methods = Lists.transform(resource.methods(), new Function<Method, GMethod>() {

        @Nullable
        @Override
        public GMethod apply(@Nullable Method input) {
            return new V10GMethod(registry, V10GResource.this, input);
        }
    });

}

From source file:org.opendaylight.controller.yang.parser.util.ModuleDependencySort.java

public static List<ModuleBuilder> sortWithContext(SchemaContext context, ModuleBuilder... builders) {
    List<Object> modules = new ArrayList<Object>();
    Collections.addAll(modules, builders);
    modules.addAll(context.getModules());

    List<Node> sorted = sortInternal(modules);
    // Cast to ModuleBuilder from Node if possible and return
    return Lists.transform(sorted, new Function<Node, ModuleBuilder>() {

        @Override// w  ww . ja v a 2s.  com
        public ModuleBuilder apply(Node input) {
            if (((ModuleNodeImpl) input).getReference() instanceof ModuleBuilder) {
                return (ModuleBuilder) ((ModuleNodeImpl) input).getReference();
            } else {
                return null;
            }
        }
    });
}

From source file:org.apache.druid.emitter.ambari.metrics.AmbariMetricsEmitterModule.java

@Provides
@ManageLifecycle//  ww w.  ja v  a 2  s.  c  o m
@Named(EMITTER_TYPE)
public Emitter getEmitter(AmbariMetricsEmitterConfig emitterConfig, final Injector injector) {
    List<Emitter> emitters = Lists.transform(emitterConfig.getAlertEmitters(), new Function<String, Emitter>() {
        @Override
        public Emitter apply(String s) {
            return injector.getInstance(Key.get(Emitter.class, Names.named(s)));
        }
    });
    return new AmbariMetricsEmitter(emitterConfig, emitters);
}

From source file:org.apache.marmotta.platform.security.webservices.SecurityWebService.java

@Path("/constraints")
@GET//from   w  ww.j a  v  a 2s .co  m
@Produces("application/json")
public Response listConstraints() {
    List<Map<String, Object>> result = Lists.transform(securityService.listSecurityConstraints(),
            new Function<SecurityConstraint, Map<String, Object>>() {
                @Override
                public Map<String, Object> apply(SecurityConstraint input) {
                    return formatConstraint(input);
                }
            });

    return Response.ok().entity(result).build();

}

From source file:co.cask.cdap.data.tools.StreamStateStoreUpgrader.java

@Override
protected Iterable<TableId> getTableIds() throws Exception {
    return Lists.transform(namespaceAdmin.list(), new Function<NamespaceMeta, TableId>() {
        @Override/*www .  j a  v a 2  s.  c  om*/
        public TableId apply(NamespaceMeta input) {
            return StreamUtils.getStateStoreTableId(Id.Namespace.from(input.getName()));
        }
    });
}