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.locationtech.geogig.model.impl.RevFeatureImpl.java

@Override
public ImmutableList<Optional<Object>> getValues() {
    return ImmutableList.copyOf(Lists.transform(values, (v) -> Optional.fromNullable(safeCopy(v))));
}

From source file:org.sosy_lab.cpachecker.cfa.model.MultiEdge.java

public MultiEdge(CFANode pPredecessor, CFANode pSuccessor, List<CFAEdge> pEdges) {
    super("", FileLocation.merge(Lists.transform(pEdges, new Function<CFAEdge, FileLocation>() {
        @Override//from   ww  w .j a v a2 s . c  o  m
        public FileLocation apply(CFAEdge pInput) {
            return pInput.getFileLocation();
        }
    })), pPredecessor, pSuccessor);
    edges = ImmutableList.copyOf(pEdges);
}

From source file:com.blacklocus.jres.request.search.query.JresBoolQuery.java

public JresBoolQuery must(List<JresQuery> must) {
    this.must = Lists.transform(must, new Function<JresQuery, Map<String, JresQuery>>() {
        @Override/*from www.jav a 2s  .c om*/
        public Map<String, JresQuery> apply(JresQuery input) {
            return ImmutableMap.of(input.queryType(), input);
        }
    });
    return this;
}

From source file:com.shigengyu.hyperion.core.WorkflowStateSet.java

public static WorkflowStateSet from(Collection<String> workflowStateIds) {

    List<WorkflowState> workflowStates = Lists.transform(Lists.newArrayList(workflowStateIds),
            new Function<String, WorkflowState>() {

                @Override/*from   www.j  a  va  2 s .co  m*/
                public WorkflowState apply(String input) {
                    return WorkflowState.byId(input);
                }
            });

    return WorkflowStateSet.from(workflowStates);
}

From source file:io.druid.query.aggregation.atomcube.AtomCubeResultValue.java

public AtomCubeResultValue(List<?> value) {
    this.value = (value == null) ? Lists.<DimensionAndMetricValueExtractor>newArrayList()
            : Lists.transform(value, new Function<Object, DimensionAndMetricValueExtractor>() {
                @Override//w w  w.  ja  v  a 2  s  .c o m
                public DimensionAndMetricValueExtractor apply(@Nullable Object input) {
                    if (input instanceof Map) {
                        return new DimensionAndMetricValueExtractor((Map) input);
                    } else if (input instanceof DimensionAndMetricValueExtractor) {
                        return (DimensionAndMetricValueExtractor) input;
                    } else {
                        throw new IAE("Unknown type for input[%s]", input.getClass());
                    }
                }
            });
}

From source file:com.yahoo.druid.hadoop.DruidHelper.java

public List<String> getSegmentPathsToLoad(final String dataSource, final Interval interval,
        final String storageDir, final String overlordUrl) {
    List<DataSegment> segmentsToLoad = getSegmentsToLoad(dataSource, interval, overlordUrl);

    return Lists.transform(segmentsToLoad, new Function<DataSegment, String>() {
        @Nullable//w ww  .  j ava  2s. co m
        @Override
        public String apply(DataSegment segment) {
            return (String) segment.getLoadSpec().get("path");
        }
    });
}

From source file:com.cloudera.exhibit.avro.AvroFrame.java

public AvroFrame(final ObsDescriptor descriptor, List<? extends GenericRecord> records) {
    this.descriptor = descriptor;
    this.records = ImmutableList.copyOf(Lists.transform(records, new Function<GenericRecord, Obs>() {
        @Override//from  ww  w . j av  a2 s. c  o  m
        public Obs apply(GenericRecord genericRecord) {
            return new AvroObs(descriptor, genericRecord);
        }
    }));
}

From source file:eu.itesla_project.computation.AbstractCommand.java

@Override
public List<OutputFile> getOutputFiles(final String executionNumber) {
    return Lists.transform(outputFiles, new Function<OutputFile, OutputFile>() {
        @Override//from w w  w .ja v  a2 s. c  o m
        public OutputFile apply(OutputFile file) {
            return file.instanciate(executionNumber);
        }
    });
}

From source file:io.druid.java.util.metrics.CompoundMonitor.java

@Override
public boolean monitor(final ServiceEmitter emitter) {
    return shouldReschedule(Lists.transform(monitors, monitor -> monitor.monitor(emitter)));
}

From source file:org.gradle.model.internal.core.ExtractedModelMutator.java

@Override
public List<Class<?>> getRuleDependencies() {
    return Lists.transform(dependencies, new Function<ModelType<?>, Class<?>>() {
        @Override/* w ww  .  jav a  2 s  . c om*/
        public Class<?> apply(ModelType<?> type) {
            return type.getRawClass();
        }
    });
}