Example usage for com.google.common.collect FluentIterable from

List of usage examples for com.google.common.collect FluentIterable from

Introduction

In this page you can find the example usage for com.google.common.collect FluentIterable from.

Prototype

@Deprecated
@CheckReturnValue
public static <E> FluentIterable<E> from(FluentIterable<E> iterable) 

Source Link

Document

Construct a fluent iterable from another fluent iterable.

Usage

From source file:google.registry.util.TokenUtils.java

/** Generates an {@link ImmutableSet} of tokens of a given {@link TokenType}. */
public static ImmutableSet<String> createTokens(final TokenType type, StringGenerator generator, int count) {
    return FluentIterable.from(generator.createStrings(type.getLength(), count))
            .transform(new Function<String, String>() {
                @Override//from www  .j  av a2 s.  c o  m
                public String apply(String token) {
                    return String.format("%s_%s", type.getPrefix(), token);
                }
            }).toSet();
}

From source file:com.github.fge.jackson.SampleNodeProvider.java

public static Iterator<Object[]> getSamples(final EnumSet<NodeType> types) {
    final Map<NodeType, JsonNode> map = Maps.newEnumMap(SAMPLE_DATA);
    map.keySet().retainAll(types);//from w  w w.  j  av  a2  s . co  m

    return FluentIterable.from(map.values()).transform(new Function<JsonNode, Object[]>() {
        @Override
        public Object[] apply(final JsonNode input) {
            return new Object[] { input };
        }
    }).iterator();
}

From source file:ratpack.guice.internal.InjectorRegistryBacking.java

@Override
public <T> Iterable<Supplier<? extends T>> provide(TypeToken<T> type) {
    return FluentIterable.from(GuiceUtil.allProvidersOfType(injector, type))
            .transform(provider -> provider::get);
}

From source file:com.facebook.buck.apple.AppleResources.java

/**
 * Collect resources from recursive dependencies.
 *
 * @param targetGraph The {@link TargetGraph} containing the node and its dependencies.
 * @param targetNodes {@link TargetNode} at the tip of the traversal.
 * @return The recursive resource buildables.
 *//*from w ww  .ja  v  a2  s  . c o  m*/
public static ImmutableSet<AppleResourceDescription.Arg> collectRecursiveResources(
        final TargetGraph targetGraph, final Optional<AppleDependenciesCache> cache,
        Iterable<? extends TargetNode<?, ?>> targetNodes) {
    return FluentIterable.from(targetNodes)
            .transformAndConcat(AppleBuildRules.newRecursiveRuleDependencyTransformer(targetGraph, cache,
                    AppleBuildRules.RecursiveDependenciesMode.COPYING,
                    ImmutableSet.of(AppleResourceDescription.class)))
            .transform(input -> (AppleResourceDescription.Arg) input.getConstructorArg()).toSet();
}

From source file:com.siemens.sw360.commonIO.TypeMappings.java

public static <T, U> ImmutableList<T> getElementsWithIdentifiersNotInMap(Function<T, U> getIdentifier,
        Map<U, T> theMap, List<T> candidates) {
    return FluentIterable.from(candidates).filter(
            CommonUtils.afterFunction(getIdentifier).is(containedWithAddIn(Sets.newHashSet(theMap.keySet()))))
            .toList();/*from   ww  w. j  a  va2  s  .  c  o  m*/
}

From source file:it.r.dddtoolkit.ddd.memory.InMemoryDomainRepository.java

protected FluentIterable<E> entities() {
    return FluentIterable.from(store.values());
}

From source file:com.webbfontaine.valuewebb.irms.factory.ActionFactoryContainer.java

public List<ActionProcessor> getActionProcessors(final Iterable<Annotation> annotations) {
    return FluentIterable.from(factories).filter(new Predicate<ActionFactory>() {
        @Override/*  www.j a  va2 s.  c  o  m*/
        public boolean apply(final ActionFactory factory) {
            return any(annotations, new ActionFactoryPredicate(factory));
        }
    }).transform(new Function<ActionFactory, ActionProcessor>() {
        @Override
        public ActionProcessor apply(ActionFactory actionFactory) {
            return actionFactory.getActionProcessor();
        }
    }).toList();
}

From source file:aeon.compiler.context.AbstractFieldContext.java

@NotNull
public FluentIterable<T> getFields() {
    return FluentIterable.from(mFields);
}

From source file:org.eclipse.buildship.ui.util.workbench.WorkingSetUtils.java

/**
 * Converts the given working {@link org.eclipse.ui.IWorkingSet} instances to working set names.
 *
 * @param workingSets the working sets// www. j  av  a  2s  . c  o  m
 * @return the names of the working sets
 */
public static List<String> toWorkingSetNames(List<IWorkingSet> workingSets) {
    return FluentIterable.from(workingSets).transform(new Function<IWorkingSet, String>() {

        @Override
        public String apply(IWorkingSet workingSet) {
            return workingSet.getName();
        }
    }).toList();
}

From source file:com.eightkdata.mongowp.messages.utils.SimpleIterableDocumentProvider.java

SimpleIterableDocumentProvider(Iterable<E> documents) {
    this.documents = FluentIterable.from(documents);
}