List of usage examples for com.google.common.collect Iterables transform
@CheckReturnValue public static <F, T> Iterable<T> transform(final Iterable<F> fromIterable, final Function<? super F, ? extends T> function)
From source file:shaded.org.openqa.selenium.remote.server.handler.FindElements.java
@Override public Set<Map<String, String>> call() throws Exception { List<WebElement> elements = getDriver().findElements(by); return Sets.newLinkedHashSet(Iterables.transform(elements, new Function<WebElement, Map<String, String>>() { public Map<String, String> apply(WebElement element) { return ImmutableMap.of("ELEMENT", getKnownElements().add(element)); }/*from ww w. ja v a 2 s . com*/ })); }
From source file:org.eclipse.emf.mwe2.language.scoping.MapBasedScope.java
@Override protected Iterable<IEObjectDescription> getAllLocalElements() { return Iterables.transform(entries.entrySet(), new Function<Map.Entry<QualifiedName, ? extends EObject>, IEObjectDescription>() { public IEObjectDescription apply(Map.Entry<QualifiedName, ? extends EObject> from) { return new MapEntry(from); }/* w w w. jav a2 s .c o m*/ }); }
From source file:com.facebook.buck.cxx.toolchain.ClangPreprocessor.java
@Override public final Iterable<String> localIncludeArgs(Iterable<String> includeRoots) { return MoreIterables.zipAndConcat(Iterables.cycle("-I"), Iterables.transform(includeRoots, MorePaths::pathWithUnixSeparators)); }
From source file:com.github.x3333.dagger.aop.internal.Util.java
/** * Convert a {@link Iterable} of {@link Element} to a {@link Iterable} of {@link String} using {@link Element#getSimpleName()}. *//*w w w .j a va 2 s . c o m*/ static Iterable<String> simpleNames(final Iterable<? extends Element> elements) { return Iterables.transform(elements, e -> e.getSimpleName().toString()); }
From source file:org.apache.crunch.impl.spark.fn.PairFlatMapDoFn.java
@Override public Iterable<Tuple2<K, V>> call(Iterator<T> input) throws Exception { ctxt.initialize(fn, null);//from w ww . ja v a 2 s .c o m return Iterables.transform(new CrunchIterable<T, Pair<K, V>>(fn, input), GuavaUtils.<K, V>pair2tupleFunc()); }
From source file:org.sonar.server.computation.step.AbstractComputationSteps.java
@Override public Iterable<ComputationStep> instances() { return Iterables.transform(orderedStepClasses(), new Function<Class<? extends ComputationStep>, ComputationStep>() { @Override// w w w .j a va 2 s . co m public ComputationStep apply(@Nonnull Class<? extends ComputationStep> input) { ComputationStep computationStepType = container.getComponentByType(input); if (computationStepType == null) { throw new IllegalStateException(String.format("Component not found: %s", input)); } return computationStepType; } }); }
From source file:org.isisaddons.wicket.timeline.cpt.ui.TimelineEventableCollectionAsTimeline.java
@Override protected Set<String> getTimelineNames(final Collection<ObjectAdapter> entityList) { return Sets.newLinkedHashSet( Iterables.transform(entityList, TimelineEventableEventProvider.GET_Timeline_NAME)); }
From source file:co.cask.cdap.shell.completer.element.DatasetTypeNameCompleter.java
@Inject public DatasetTypeNameCompleter(final DatasetTypeClient datasetTypeClient) { super(new Supplier<Collection<String>>() { @Override//from ww w.ja va 2s .co m public Collection<String> get() { try { List<DatasetTypeMeta> list = datasetTypeClient.list(); return Lists.newArrayList(Iterables.transform(list, new Function<DatasetTypeMeta, String>() { @Override public String apply(DatasetTypeMeta input) { return input.getName(); } })); } catch (IOException e) { return Lists.newArrayList(); } catch (UnAuthorizedAccessTokenException e) { return Lists.newArrayList(); } } }); }
From source file:uk.ac.stfc.isis.ibex.configserver.json.IocStateConverter.java
@Override public Collection<IocState> convert(Map<String, IocParameters> value) throws ConversionException { return Lists.newArrayList( Iterables.transform(value.entrySet(), new Function<Map.Entry<String, IocParameters>, IocState>() { @Override/*from ww w . j a v a2 s. c o m*/ public IocState apply(Entry<String, IocParameters> entry) { String name = entry.getKey(); IocParameters parameters = entry.getValue(); return new IocState(name, parameters.isRunning(), parameters.getDescription(), true); } })); }
From source file:com.google.devtools.build.lib.skyframe.ArtifactSkyKey.java
@ThreadSafe public static Iterable<SkyKey> mandatoryKeys(Iterable<Artifact> artifacts) { return Iterables.transform(artifacts, TO_MANDATORY_KEY); }