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:domper.probe.android.service.data.AppConfig.java

public domper.probe.Message.AppConfig asProtoBuf() {
    return domper.probe.Message.AppConfig.newBuilder().addAllItem(Lists.transform(items, toProtoBuf)).build();
}

From source file:domper.probe.android.service.data.DeviceInfo.java

public domper.probe.Message.DeviceInfo asProtoBuf() {
    return domper.probe.Message.DeviceInfo.newBuilder().addAllItem(Lists.transform(items, toProtoBuf)).build();
}

From source file:com.cloudera.exhibit.server.main.ExhibitConfiguration.java

public ExhibitStore getExhibitStores(final Environment env, final org.apache.hadoop.conf.Configuration conf) {
    return MultiExhibitStore.create(Lists.transform(exhibits, new Function<ExhibitStoreConfig, ExhibitStore>() {
        @Override/*w ww  . ja v a 2s .c  o m*/
        public ExhibitStore apply(ExhibitStoreConfig exhibitStoreConfig) {
            LOG.info("Creating exhibit store from config: " + exhibitStoreConfig);
            return exhibitStoreConfig.create(env, conf);
        }
    }));
}

From source file:uk.ac.ed.inf.ace.tasks.MultiClassTask.java

protected MultiClassTask(E engine, C config, Function<String, Object> parseConfigLabel) {
    super(engine, config);
    this.parseConfigLabel = parseConfigLabel;
    this.labels = ImmutableSet.<Object>copyOf(Lists.transform(config.getLabels(), parseConfigLabel));
}

From source file:io.prestosql.operator.window.ReflectionWindowFunctionSupplier.java

public ReflectionWindowFunctionSupplier(String name, Type returnType, List<? extends Type> argumentTypes,
        Class<T> type) {//from   w  w w. j a va2s  . c o  m
    this(new Signature(name, WINDOW, returnType.getTypeSignature(),
            Lists.transform(argumentTypes, Type::getTypeSignature)), type);
}

From source file:com.facebook.presto.execution.ConnectorAwareSplitSource.java

@Override
public List<Split> getNextBatch(int maxSize) throws InterruptedException {
    return Lists.transform(source.getNextBatch(maxSize), Split.fromConnectorSplit(connectorId));
}

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

/**
 * Topological sort of module builder dependency graph.
 *
 * @return Sorted list of Module builders. Modules can be further processed
 *         in returned order./*from   w  ww  .  j a  va  2  s .c o  m*/
 */
public static List<ModuleBuilder> sort(ModuleBuilder... builders) {
    List<Node> sorted = sortInternal(Arrays.asList(builders));
    // Cast to ModuleBuilder from Node and return
    return Lists.transform(sorted, new Function<Node, ModuleBuilder>() {

        @Override
        public ModuleBuilder apply(Node input) {
            return (ModuleBuilder) ((ModuleNodeImpl) input).getReference();
        }
    });
}

From source file:org.jetbrains.jet.plugin.navigation.NavigationTestUtils.java

public static void assertGotoImplementations(Editor editor, GotoTargetHandler.GotoData gotoData) {
    // Get expected references from the tested document
    List<String> expectedReferences = InTextDirectivesUtils.findListWithPrefix("// REF:",
            editor.getDocument().getText());
    Collections.sort(expectedReferences);

    if (gotoData != null) {
        // Transform given reference result to strings
        List<String> psiElements = Lists.transform(Arrays.asList(gotoData.targets),
                new Function<PsiElement, String>() {
                    @Override//from  w w  w . ja  v a  2s .c om
                    public String apply(@Nullable PsiElement element) {
                        Assert.assertNotNull(element);
                        return ReferenceUtils.renderAsGotoImplementation(element);
                    }
                });

        // Compare
        UsefulTestCase.assertOrderedEquals(Ordering.natural().sortedCopy(psiElements), expectedReferences);
    } else {
        UsefulTestCase.assertEmpty(expectedReferences);
    }
}

From source file:com.onboard.domain.transform.AttachmentTransform.java

public static final Attachment attachmentDTOToAttachment(AttachmentDTO attachmentDTO) {
    Attachment attachment = new Attachment();
    BeanUtils.copyProperties(attachmentDTO, attachment);
    if (attachmentDTO.getTagDtos() != null) {
        attachment.setTags(Lists.transform(attachmentDTO.getTagDtos(), TagTransform.TAGDTO_TO_TAG_FUNCTION));
    }/*from   w  w w  .  j  av  a 2  s . c  o m*/
    return attachment;
}

From source file:io.druid.query.UnionDataSource.java

@Override
public List<String> getNames() {
    return Lists.transform(dataSources, new Function<TableDataSource, String>() {
        @Override/*from w w w . j a  va 2s.co  m*/
        public String apply(TableDataSource input) {
            return Iterables.getOnlyElement(input.getNames());
        }
    });
}