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

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

Introduction

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

Prototype

@CheckReturnValue
public static <F, T> Iterable<T> transform(final Iterable<F> fromIterable,
        final Function<? super F, ? extends T> function) 

Source Link

Document

Returns an iterable that applies function to each element of fromIterable .

Usage

From source file:org.jclouds.glacier.blobstore.functions.PaginatedVaultCollectionToStorageMetadata.java

@Override
public PageSet<? extends StorageMetadata> apply(PaginatedVaultCollection vaults) {
    return new PageSetImpl<StorageMetadata>(Iterables.transform(vaults, new VaultMetadataToStorageMetadata()),
            (String) vaults.nextMarker().orNull());
}

From source file:com.madvay.tools.android.perf.common.TraceTransformableTable.java

public void splitTraces() {
    setRows(Lists.newArrayList(Iterables.concat(Iterables.transform(getRows(), new Function<T, Iterable<T>>() {
        @Override/*  w w w .j a  va2s . c om*/
        public Iterable<T> apply(T input) {
            List<T> ret = new ArrayList<T>();
            for (StackTraceElement ste : input.getTransformableTrace()) {
                ret.add(newRowWithTrace(input, Lists.newArrayList(ste)));
            }
            return ret;
        }
    }))));
}

From source file:ivorius.ivtoolkit.tools.Pairs.java

public static <L, R> Iterable<Pair<L, R>> pairRight(Iterable<L> left, final R right) {
    return Iterables.transform(left, new Function<L, Pair<L, R>>() {
        @Nullable//from  w w w . j  av  a 2 s  . c o m
        @Override
        public Pair<L, R> apply(L input) {
            return Pair.of(input, right);
        }
    });
}

From source file:org.apache.aurora.common.args.parsers.ListParser.java

@Override
List<?> doParse(final ParserOracle parserOracle, String raw, final List<Type> typeParams) {
    final Type listType = typeParams.get(0);
    final Parser<?> parser = parserOracle.get(TypeToken.of(listType));
    return ImmutableList.copyOf(Iterables.transform(Parsers.MULTI_VALUE_SPLITTER.split(raw),
            raw1 -> parser.parse(parserOracle, listType, raw1)));
}

From source file:com.google.devtools.build.lib.testutil.EventIterableSubject.java

IterableSubject hasEventsThat() {
    return assertThat(Iterables.transform(actual(), Event::getMessage));
}

From source file:serializr.ast.ModifierNode.java

private HashSet<String> toStringSet() {
    return Sets.newHashSet(Iterables.transform(new TreeChildrenIterable(this), new Function<Tree, String>() {

        @Override//from w  w w. j  a va  2 s. c o m
        public String apply(Tree tree) {
            return tree.getText();
        }
    }));
}

From source file:org.apache.aurora.common.args.parsers.SetParser.java

@Override
Set<?> doParse(final ParserOracle parserOracle, String raw, List<Type> typeParams) {
    final Type setType = typeParams.get(0);
    final Parser<?> parser = parserOracle.get(TypeToken.of(setType));

    return ImmutableSet.copyOf(Iterables.transform(Parsers.MULTI_VALUE_SPLITTER.split(raw),
            raw1 -> parser.parse(parserOracle, setType, raw1)));
}

From source file:org.killbill.billing.invoice.dao.InvoiceModelDaoHelper.java

public static BigDecimal getCBAAmount(final InvoiceModelDao invoiceModelDao) {
    return InvoiceCalculatorUtils.computeInvoiceAmountCredited(invoiceModelDao.getCurrency(), Iterables
            .transform(invoiceModelDao.getInvoiceItems(), new Function<InvoiceItemModelDao, InvoiceItem>() {
                @Override//w  ww .jav  a  2  s  .c  o  m
                public InvoiceItem apply(final InvoiceItemModelDao input) {
                    return InvoiceItemFactory.fromModelDao(input);
                }
            }));
}

From source file:com.yammer.collections.azure.AbstractCollectionView.java

@Override
public boolean contains(Object o) {
    return o != null && Iterables.contains(Iterables.transform(getBackingIterable(), typeExtractor), o);
}

From source file:org.atlasapi.application.writers.UsersListWriter.java

private Iterable<String> getStringAppIds(User user) {
    return Iterables.transform(user.getApplicationIds(), ENCODE_APP_IDS);
}