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.apache.beam.sdk.io.gcp.bigquery.TransformingSource.java

@Override
public List<? extends BoundedSource<V>> split(long desiredBundleSizeBytes, PipelineOptions options)
        throws Exception {
    return Lists.transform(boundedSource.split(desiredBundleSizeBytes, options),
            new Function<BoundedSource<T>, BoundedSource<V>>() {
                @Override/*w w  w .j  a  va2  s .  c  o  m*/
                public BoundedSource<V> apply(BoundedSource<T> input) {
                    return new TransformingSource<>(input, function, outputCoder);
                }
            });
}

From source file:com.cloudera.oryx.ml.serving.als.EstimateForAnonymous.java

static List<Pair<String, Double>> parsePathSegments(List<PathSegment> pathSegments) {
    return Lists.transform(pathSegments, new Function<PathSegment, Pair<String, Double>>() {
        @Override//from w  ww.  ja  v a  2 s  . c om
        public Pair<String, Double> apply(PathSegment segment) {
            String s = segment.getPath();
            int offset = s.indexOf('=');
            return offset < 0 ? new Pair<>(s, 1.0)
                    : new Pair<>(s.substring(0, offset), Double.parseDouble(s.substring(offset + 1)));
        }
    });
}

From source file:org.isisaddons.app.kitchensink.dom.mixins.mixin.Person_addPreference.java

public List<FoodStuff> choices1$$() {
    final List<FoodStuff> allFoodstuffs = Lists.newArrayList(this.foodStuffs.listAllFoodStuffs());
    final List<FoodStuff> currentFoodStuffs = Lists.transform(preferencesService.preferencesOf(person),
            Preference.Functions.food());
    allFoodstuffs.removeAll(currentFoodStuffs);
    return allFoodstuffs;
}

From source file:org.sosy_lab.cpachecker.util.predicates.interpolation.strategy.SequentialInterpolationWithSolver.java

@Override
public List<BooleanFormula> getInterpolants(final InterpolationManager.Interpolator<T> interpolator,
        final List<Triple<BooleanFormula, AbstractState, T>> formulasWithStatesAndGroupdIds)
        throws InterruptedException, SolverException {
    return interpolator.itpProver.getSeqInterpolants(
            wrapAllInSets(Lists.transform(formulasWithStatesAndGroupdIds, Triple.<T>getProjectionToThird())));
}

From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.translate.processors.DefaultDispatchProcessor.java

private static List<NormalWord> extractNames(final List<Arc> targets) {
    return ImmutableList.copyOf(Lists.transform(targets, new Function<Arc, NormalWord>() {
        @Override//from   w  w w.  ja  va 2 s  .c o  m
        public NormalWord apply(final Arc input) {
            return input.getName();
        }
    }));
}

From source file:edu.umn.msi.tropix.client.directory.impl.LocalPersonSupplierImpl.java

public Multimap<String, Person> get() {
    Iterable<Person> persons = Lists.transform(Arrays.asList(userService.getUsers()), USER_TO_PERSON_FUNCTION);
    final Multimap<String, Person> personMap = HashMultimap.create();
    personMap.putAll(institution, persons);
    return personMap;
}

From source file:com.google.gerrit.server.extensions.events.ReviewerAdded.java

public void fire(Change change, PatchSet patchSet, List<Account> reviewers, Account adder, Timestamp when) {
    if (!listeners.iterator().hasNext() || reviewers.isEmpty()) {
        return;//from w w  w . jav a2 s. c o  m
    }

    try {
        Event event = new Event(util.changeInfo(change), util.revisionInfo(change.getProject(), patchSet),
                Lists.transform(reviewers, util::accountInfo), util.accountInfo(adder), when);
        for (ReviewerAddedListener l : listeners) {
            try {
                l.onReviewersAdded(event);
            } catch (Exception e) {
                util.logEventListenerError(this, l, e);
            }
        }
    } catch (PatchListNotAvailableException | GpgException | IOException | OrmException e) {
        log.error("Couldn't fire event", e);
    }
}

From source file:com.android.tools.idea.logcat.PersistentAndroidLogFilters.java

/**
 * Returns a copy of the list of filters. If you need to modify a filter, use
 * {@link #setFilters(List)} to do so.//from   w  w  w.  jav  a2 s .  com
 */
@Tag("filters")
@AbstractCollection(surroundWithTag = false)
public List<FilterData> getFilters() {
    return Lists.newArrayList(Lists.transform(myFilters, new Function<FilterData, FilterData>() {
        @NotNull
        @Override
        public FilterData apply(FilterData filter) {
            return new FilterData(filter);
        }
    }));
}

From source file:org.apache.kylin.source.kafka.config.KafkaClusterConfig.java

public List<Broker> getBrokers() {
    return Lists.transform(brokerConfigs, new Function<BrokerConfig, Broker>() {
        @Nullable// ww  w .j  a  v a  2 s  . com
        @Override
        public Broker apply(BrokerConfig input) {
            return new Broker(input.getId(), input.getHost(), input.getPort(), SecurityProtocol.PLAINTEXT);
        }
    });
}

From source file:com.google.gerrit.server.account.GetSshKeys.java

public List<SshKeyInfo> apply(IdentifiedUser user)
        throws RepositoryNotFoundException, IOException, ConfigInvalidException {
    return Lists.transform(authorizedKeys.getKeys(user.getAccountId()), GetSshKeys::newSshKeyInfo);
}