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:org.androidtransfuse.analysis.astAnalyzer.ManualSuperAspect.java

public void add(ASTMethod eventMethod) {
    add(eventMethod.getName(),//  ww w .  j av a 2  s .com
            FluentIterable.from(eventMethod.getParameters()).transform(new Function<ASTParameter, ASTType>() {
                public ASTType apply(ASTParameter parameter) {
                    return parameter.getASTType();
                }
            }).toList());
}

From source file:org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler.java

@Override
public FluentIterable<AccountLevelGroup> getResult() {
    return FluentIterable.from(groups.build());
}

From source file:fr.javatronic.damapping.test.injectable.mapping.InjectableFloorToFloorDto.java

@Nullable
@Override
public FloorDto apply(@Nullable Floor floor) {
    return new FloorDto(FluentIterable.from(floor.getRooms()).transform(roomToRoomDtoMapper).toList());
}

From source file:com.qcadoo.mes.basic.shift.ShiftsDataProviderImpl.java

@Override
public List<Shift> findAll() {
    return FluentIterable.from(getAllShifts()).transform(new Function<Entity, Shift>() {

        @Override//w  w  w .  ja  v  a  2 s.com
        public Shift apply(final Entity shiftEntity) {
            return new Shift(shiftEntity);
        }
    }).toList();
}

From source file:org.immutables.value.processor.meta.FactoryMethodAttributesCollector.java

private static ImmutableList<String> extractThrowsClause(ExecutableElement factoryMethodElement) {
    return FluentIterable.from(factoryMethodElement.getThrownTypes()).transform(Functions.toStringFunction())
            .toList();//w  ww.  jav  a2  s .c  om
}

From source file:org.mayocat.shop.catalog.front.context.LocalesInfoWebDataSupplier.java

@Override
public void supply(Map<String, Object> data) {
    // Manage list of locales and corresponding links
    String path = context.getRequest().getCanonicalPath();
    Map<String, Map<String, String>> locales = Maps.newHashMap();
    GeneralSettings settings = context.getSettings(GeneralSettings.class);
    final Locale mainLocale = settings.getLocales().getMainLocale().getValue();
    locales.put(mainLocale.toLanguageTag(), buildLocale(mainLocale, path, true));
    List<Locale> alternativeLocales = FluentIterable.from(settings.getLocales().getOtherLocales().getValue())
            .filter(Predicates.notNull()).toList();
    if (!alternativeLocales.isEmpty()) {
        for (final Locale locale : alternativeLocales) {
            locales.put(locale.toLanguageTag(), buildLocale(locale, path, false));
        }// w  w w .j a  va 2 s .  co m
    }

    data.put("locales", locales);
    data.put("locale", buildLocale(context.getLocale(), path, mainLocale.equals(context.getLocale())));
    data.put("localePath", context.isAlternativeLocale() ? ("/" + context.getLocale().toLanguageTag()) : "");
    data.put("url", data.get("localePath") + path);
    data.put("canonicalUrl", path);
}

From source file:org.jclouds.ultradns.ws.xml.TaskListHandler.java

@Override
public FluentIterable<Task> getResult() {
    return FluentIterable.from(tasks.build());
}

From source file:com.facebook.buck.jvm.java.DefaultSuggestBuildRules.java

/**
 * @return A function that takes a list of failed imports from a javac invocation and returns a
 *    set of rules to suggest that the developer import to satisfy those imports.
 *///from ww w  .  j a  va  2  s  . co m
static SuggestBuildRules createSuggestBuildFunction(final JarResolver jarResolver,
        final ImmutableSet<JavaLibrary> declaredDeps, final ImmutableSet<JavaLibrary> transitiveDeps,
        final Iterable<BuildRule> buildRules) {

    final Supplier<ImmutableList<JavaLibrary>> sortedTransitiveNotDeclaredDeps = Suppliers
            .memoize(new Supplier<ImmutableList<JavaLibrary>>() {
                @Override
                public ImmutableList<JavaLibrary> get() {
                    Set<JavaLibrary> transitiveNotDeclaredDeps = Sets.difference(transitiveDeps,
                            Sets.union(ImmutableSet.of(this), declaredDeps));
                    DirectedAcyclicGraph<BuildRule> graph = BuildRuleDependencyVisitors
                            .getBuildRuleDirectedGraphFilteredBy(buildRules, JavaLibrary.class::isInstance,
                                    JavaLibrary.class::isInstance);
                    return FluentIterable.from(TopologicalSort.sort(graph)).filter(JavaLibrary.class)
                            .filter(transitiveNotDeclaredDeps::contains).toList().reverse();
                }
            });

    return new DefaultSuggestBuildRules(sortedTransitiveNotDeclaredDeps, jarResolver);
}

From source file:org.mayocat.shop.billing.store.memory.MemoryOrderStore.java

@Override
public Integer countAllPaidOrAwaitingPayment() {
    return FluentIterable.from(all()).filter(paidOrAwaitingPayment).size();
}

From source file:com.jeroensteenbeeke.andalite.java.analyzer.expression.ArrayInitializerExpression.java

@Override
public String toJavaString() {
    return String.format("{%s}",
            Joiner.on(", ").join(FluentIterable.from(values).transform(toJavaStringFunction())));
}