List of usage examples for com.google.common.collect FluentIterable toSet
@CheckReturnValue public final ImmutableSet<E> toSet()
From source file:com.facebook.buck.features.go.GoDescriptors.java
@SuppressWarnings("unchecked") public static ImmutableSet<GoLinkable> requireTransitiveGoLinkables(BuildTarget sourceTarget, ActionGraphBuilder graphBuilder, GoPlatform platform, Iterable<BuildTarget> targets, boolean includeSelf) { FluentIterable<GoLinkable> linkables = FluentIterable.from(targets).transformAndConcat(input -> { BuildTarget flavoredTarget = input.withAppendedFlavors(platform.getFlavor(), TRANSITIVE_LINKABLES_FLAVOR); return graphBuilder.requireMetadata(flavoredTarget, ImmutableSet.class).get(); });//w w w. j av a 2s .co m if (includeSelf) { Preconditions.checkArgument(sourceTarget.getFlavors().contains(TRANSITIVE_LINKABLES_FLAVOR)); linkables = linkables.append(requireGoLinkable(sourceTarget, graphBuilder, platform, sourceTarget.withoutFlavors(TRANSITIVE_LINKABLES_FLAVOR))); } return linkables.toSet(); }
From source file:springfox.documentation.spring.web.readers.operation.OperationTagsReader.java
@Override public void apply(OperationContext context) { ResourceGroupingStrategy groupingStrategy = pluginsManager .resourceGroupingStrategy(context.getDocumentationType()); Set<ResourceGroup> resourceGroups = groupingStrategy.getResourceGroups(context.getRequestMappingInfo(), context.getHandlerMethod()); FluentIterable<String> tags = FluentIterable.from(resourceGroups).transform(toTags()); context.operationBuilder().tags(tags.toSet()); }
From source file:org.testfx.service.query.impl.NodeQueryImpl.java
@Override @SuppressWarnings("unchecked") public <T extends Node> Set<T> queryAll() { FluentIterable<Node> query = FluentIterable.from(parentNodes); return (Set<T>) query.toSet(); }
From source file:org.testfx.service.query.impl.NodeQueryImpl.java
@Override public NodeQuery nth(int index) { FluentIterable<Node> query = FluentIterable.from(parentNodes); query = query.skip(index).limit(1);// w w w . j a v a 2s .co m parentNodes = query.toSet(); return this; }
From source file:org.testfx.service.query.impl.NodeQueryImpl.java
@Override @SuppressWarnings("unchecked") public <T extends Node> NodeQuery match(Predicate<T> predicate) { FluentIterable<Node> query = FluentIterable.from(parentNodes); query = query.filter((Predicate<Node>) predicate); parentNodes = query.toSet(); return this; }
From source file:org.testfx.service.query.impl.NodeQueryImpl.java
@Override @SuppressWarnings("unchecked") public <T> NodeQuery match(Matcher<T> matcher) { FluentIterable<Node> query = FluentIterable.from(parentNodes); query = query.filter(NodeQueryUtils.matchesMatcher((Matcher<Node>) matcher)); parentNodes = query.toSet(); return this; }
From source file:org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.java
@Override public Map<String, Supplier<URI>> get() { FluentIterable<Service> services = FluentIterable.from(access.get()).filter(apiTypeEquals); if (services.toSet().size() == 0) throw new NoSuchElementException( String.format("apiType %s not found in catalog %s", apiType, services)); Iterable<Endpoint> endpoints = concat(services); if (size(endpoints) == 0) throw new NoSuchElementException( String.format("no endpoints for apiType %s in services %s", apiType, services)); boolean checkVersionId = any(endpoints, versionAware); Multimap<String, Endpoint> locationToEndpoints = index(endpoints, endpointToLocationId); Map<String, Endpoint> locationToEndpoint; if (checkVersionId && apiVersion != null) { locationToEndpoint = refineToVersionSpecificEndpoint(locationToEndpoints); if (locationToEndpoint.size() == 0) throw new NoSuchElementException( String.format("no endpoints for apiType %s are of version %s, or version agnostic: %s", apiType, apiVersion, locationToEndpoints)); } else {// w ww. j a v a 2 s. c om locationToEndpoint = firstEndpointInLocation(locationToEndpoints); } logger.debug("endpoints for apiType %s and version %s: %s", apiType, apiVersion, locationToEndpoints); return Maps.transformValues(locationToEndpoint, endpointToSupplierURI); }
From source file:org.testfx.service.query.impl.NodeQueryImpl.java
@Override public NodeQuery lookup(Function<Node, Set<Node>> function) { FluentIterable<Node> query = FluentIterable.from(parentNodes); query = query.filter(Predicates.notNull()); query = query.transformAndConcat(function); parentNodes = query.toSet(); return this; }
From source file:com.facebook.buck.go.GoDescriptors.java
@SuppressWarnings("unchecked") public static ImmutableSet<GoLinkable> requireTransitiveGoLinkables(final BuildTarget sourceTarget, final BuildRuleResolver resolver, final GoPlatform platform, Iterable<BuildTarget> targets, boolean includeSelf) throws NoSuchBuildTargetException { FluentIterable<GoLinkable> linkables = FluentIterable.from(targets) .transformAndConcat(new Function<BuildTarget, ImmutableSet<GoLinkable>>() { @Override/* w w w.j a v a 2 s . c o m*/ public ImmutableSet<GoLinkable> apply(BuildTarget input) { BuildTarget flavoredTarget = BuildTarget.builder(input) .addFlavors(platform.getFlavor(), TRANSITIVE_LINKABLES_FLAVOR).build(); try { return resolver.requireMetadata(flavoredTarget, ImmutableSet.class).get(); } catch (NoSuchBuildTargetException ex) { throw new RuntimeException(ex); } } }); if (includeSelf) { Preconditions.checkArgument(sourceTarget.getFlavors().contains(TRANSITIVE_LINKABLES_FLAVOR)); linkables = linkables.append(requireGoLinkable(sourceTarget, resolver, platform, sourceTarget.withoutFlavors(TRANSITIVE_LINKABLES_FLAVOR))); } return linkables.toSet(); }
From source file:com.gwtplatform.processors.tools.domain.Type.java
@Override public Collection<String> getImports() { FluentIterable<String> imports = from(typeArguments).transformAndConcat(EXTRACT_IMPORTS_FUNCTION); if (!array) { imports = imports.append(getQualifiedName()); }//from www .j av a2 s .co m return imports.toSet(); }