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:com.google.devtools.moe.client.repositories.Repositories.java

@Inject
public Repositories(Set<RepositoryType.Factory> services) {
    // A Set of services is expected, and indexed by this class, so that a more dynamic set
    // of Repositories can be dynamically detected, as opposed to using a static map binder
    this.serviceFactories = FluentIterable.from(services)
            .uniqueIndex(new Function<RepositoryType.Factory, String>() {
                @Override/*  w w w  .  j  av  a 2  s.  co  m*/
                public String apply(RepositoryType.Factory input) {
                    return input.type();
                }
            });
}

From source file:info.archinnov.achilles.entity.operations.CQLEntityPersister.java

private void persistEntity(CQLPersistenceContext context, EntityMeta entityMeta) {
    persisterImpl.persist(context);/*from  w ww . j a v a 2 s . c  om*/

    List<PropertyMeta> allMetas = entityMeta.getAllMetasExceptIdMeta();

    Set<PropertyMeta> counterMetas = FluentIterable.from(allMetas).filter(counterType).toImmutableSet();

    persisterImpl.persistCounters(context, counterMetas);
}

From source file:org.eclipse.buildship.ui.view.execution.ToggleShowTreeHeaderAction.java

private void updateHeaderVisibility() {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

        @Override//from ww  w  .  j  av a  2  s . com
        public void run() {
            boolean showTreeHeader = ToggleShowTreeHeaderAction.this.treeViewerState.isShowTreeHeader();
            for (ExecutionPage executionPage : FluentIterable
                    .from(ToggleShowTreeHeaderAction.this.multiPageView.getPages())
                    .filter(ExecutionPage.class)) {
                Tree tree = executionPage.getPageControl().getViewer().getTree();
                if (!tree.isDisposed()) {
                    tree.setHeaderVisible(showTreeHeader);
                }
            }
        }
    });
}

From source file:com.ebay.pulsar.analytics.service.UserPermissionControl.java

public List<String> getAllRightsForOwner(String userName) {
    List<String> datasourceRights = FluentIterable.from(datasourceService.getAllDataSourcesForOwner(userName))
            .transform(new Function<String, String>() {
                public String apply(String input) {
                    return String.format(PermissionConst.MANAGE_RIGHT_TEMPLATE, input);
                }//from  w  ww.  j a va 2 s . c om
            }).toList();
    List<String> dashboardRights = FluentIterable.from(dashboardService.getAllDashboardsForOwner(userName))
            .transform(new Function<String, String>() {
                public String apply(String input) {
                    return String.format(PermissionConst.MANAGE_RIGHT_TEMPLATE, input);
                }
            }).toList();

    return FluentIterable.from(groupService.getGroupsByOwner(userName))
            .transform(new Function<String, String>() {
                public String apply(String input) {
                    return String.format(PermissionConst.MANAGE_RIGHT_TEMPLATE, input);
                }
            }).append(datasourceRights).append(dashboardRights).toList();
}

From source file:org.raml.jaxrs.converter.model.Utilities.java

public static FluentIterable<RamlResourceMethod> toRamlMethods(Iterable<JaxRsMethod> methods) {
    return FluentIterable.from(methods).transform(new Function<JaxRsMethod, RamlResourceMethod>() {

        @Override/* w  ww. jav  a  2  s .c o m*/
        public RamlResourceMethod apply(JaxRsMethod method) {
            return JaxRsRamlMethod.create(method);
        }
    });
}

From source file:com.palantir.atlasdb.keyvalue.impl.Cells.java

public static SortedSet<byte[]> getRows(Iterable<Cell> cells) {
    if (Iterables.isEmpty(cells)) {
        return ImmutableSortedSet.orderedBy(UnsignedBytes.lexicographicalComparator()).build();
    }/*from   w ww . j av  a 2 s.  c  om*/
    return FluentIterable.from(cells).transform(getRowFunction())
            .toSortedSet(UnsignedBytes.lexicographicalComparator());
}

From source file:springfox.documentation.service.ResolvedMethodParameter.java

public boolean hasParameterAnnotation(Class<? extends Annotation> annotation) {
    return FluentIterable.from(annotations).filter(annotation).size() > 0;
}

From source file:com.facebook.buck.d.DLibrary.java

@Override
public Iterable<NativeLinkable> getNativeLinkableExportedDeps() {
    return FluentIterable.from(getDeclaredDeps()).filter(NativeLinkable.class);
}

From source file:net.sourceforge.fenixedu.webServices.jersey.api.FenixJerseyAPIConfig.java

@Atomic
private static void removeUnusedAuthScopes() {
    final Set<AuthScope> authScopes = Bennu.getInstance().getAuthScopesSet();
    ImmutableSet<String> authScopesNames = FluentIterable.from(authScopes)
            .transform(new Function<AuthScope, String>() {

                @Override//ww  w  .j a  va  2s .c o  m
                public String apply(AuthScope scope) {
                    return scope.getName();
                }
            }).toSet();

    Collection<String> unusedScopes = CollectionUtils.subtract(authScopesNames, scopePathsMap.keySet());
    for (String unusedScope : unusedScopes) {
        AuthScope authScope = AuthScope.getAuthScope(unusedScope);
        if (authScope != null) {
            LOGGER.debug("delete unused scope {}", unusedScope);
            authScope.delete();
        }
    }
}

From source file:org.isisaddons.app.kitchensink.dom.reference.child2.ReferenceChild2Objects.java

@MemberOrder(sequence = "50")
public List<ReferenceChild2Object> findNamed(
        @ParameterLayout(named = "Search") @MinLength(1) final String search) {
    return Lists.newArrayList(
            FluentIterable.from(listAll()).filter(input -> input.getName().contains(search)).toList());
}