List of usage examples for com.google.common.collect ImmutableSet stream
default Stream<E> stream()
From source file:dagger.internal.codegen.InjectionMethods.java
/** * Returns an argument list suitable for calling an injection method. Down-casts any arguments * that are {@code Object} (or {@code Provider<Object>}) at the caller but not the method. * * @param dependencies the dependencies used by the method * @param dependencyUsage function to apply on each of {@code dependencies} before casting * @param requestingClass the class calling the injection method *//*w ww .j ava 2 s. c om*/ private static ImmutableList<CodeBlock> injectionMethodArguments(ImmutableSet<DependencyRequest> dependencies, Function<DependencyRequest, CodeBlock> dependencyUsage, ClassName requestingClass) { return dependencies.stream() .map(dep -> injectionMethodArgument(dep, dependencyUsage.apply(dep), requestingClass)) .collect(toImmutableList()); }
From source file:com.facebook.buck.features.project.intellij.IjProjectCommandHelper.java
public static ImmutableSet<BuildTarget> filterTests(ImmutableSet<BuildTarget> testTargets, CellPathResolver cellPathResolver, ImmutableSet<String> includes, ImmutableSet<String> excludes) { BuildTargetPatternParser<BuildTargetPattern> parser = BuildTargetPatternParser.forVisibilityArgument(); ImmutableSet<BuildTargetPattern> includePatterns = getPatterns(parser, cellPathResolver, includes); ImmutableSet<BuildTargetPattern> excludePatterns = getPatterns(parser, cellPathResolver, excludes); return RichStream.from(testTargets) .filter(test -> (includePatterns.isEmpty() || includePatterns.stream().anyMatch(pattern -> pattern.matches(test))) && (excludePatterns.isEmpty() || excludePatterns.stream().noneMatch(pattern -> pattern.matches(test)))) .toImmutableSet();//from w w w. j av a2 s.c o m }
From source file:com.facebook.buck.ide.intellij.IjProjectTemplateDataPreparer.java
private static ImmutableSet<IjModule> createModulesToBeWritten(IjModuleGraph graph) { Path rootModuleBasePath = Paths.get(""); boolean hasRootModule = graph.getModules().stream() .anyMatch(module -> rootModuleBasePath.equals(module.getModuleBasePath())); ImmutableSet<IjModule> supplementalModules = ImmutableSet.of(); if (!hasRootModule) { supplementalModules = ImmutableSet.of(IjModule.builder().setModuleBasePath(rootModuleBasePath) .setTargets(ImmutableSet.of()).setModuleType(IjModuleType.UNKNOWN_MODULE).build()); }// www . j ava2s .c o m return Stream.concat(graph.getModules().stream(), supplementalModules.stream()) .collect(MoreCollectors.toImmutableSet()); }
From source file:com.facebook.buck.jvm.java.intellij.IjProjectTemplateDataPreparer.java
private static ImmutableSet<IjModule> createModulesToBeWritten(IjModuleGraph graph) { Path rootModuleBasePath = Paths.get(""); boolean hasRootModule = graph.getModuleNodes().stream() .anyMatch(module -> rootModuleBasePath.equals(module.getModuleBasePath())); ImmutableSet<IjModule> supplementalModules = ImmutableSet.of(); if (!hasRootModule) { supplementalModules = ImmutableSet.of( IjModule.builder().setModuleBasePath(rootModuleBasePath).setTargets(ImmutableSet.of()).build()); }// ww w. j ava2 s . co m return Stream.concat(graph.getModuleNodes().stream(), supplementalModules.stream()) .collect(MoreCollectors.toImmutableSet()); }
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudDashApplications.java
private List<String> getNames(ImmutableSet<CloudAppDashElement> v) { return v.stream().map(CloudAppDashElement::getName).collect(Collectors.toList()); }
From source file:com.zuppelli.living.docs.ContextAwareDiagramMojo.java
protected void populatePackageInfoMap(ImmutableSet<ClassPath.ClassInfo> allClasses) { Stream<ClassPath.ClassInfo> pkFilter = allClasses.stream().filter(new PackageInfoPedicate()); pkFilter.forEach(new Consumer<ClassPath.ClassInfo>() { public void accept(ClassPath.ClassInfo ci) { Class clazz = ci.load(); DomainContext annotation = (DomainContext) clazz.getAnnotation(DomainContext.class); if (null != annotation) { packages.put(clazz.getPackage().getName(), annotation.name()); }/*w ww . ja va 2 s.c o m*/ } }); }
From source file:org.apache.james.jmap.model.MessageProperties.java
private ImmutableSet<MessageProperty> toMessageProperties(ImmutableSet<String> properties) { return properties.stream().flatMap(MessageProperty::find).collect(Guavate.toImmutableSet()); }
From source file:org.apache.james.jmap.model.MessageProperties.java
private ImmutableSet<HeaderProperty> toHeadersProperties(ImmutableSet<String> properties) { return properties.stream().flatMap(HeaderProperty::find).collect(Guavate.toImmutableSet()); }
From source file:com.zuppelli.living.docs.DomainDiagramMojo.java
@Override protected void populatePackageClusters(ImmutableSet<ClassPath.ClassInfo> allClasses, DotGraph.Digraph digraph) { Stream<ClassPath.ClassInfo> domain = allClasses.stream() .filter(filter(getPrefix(), this.getDomainPackage())); final DotGraph.Cluster core = digraph.addCluster("hexagon"); core.setLabel("Core Domain"); // add all domain model elements first domain.forEach(new Consumer<ClassPath.ClassInfo>() { public void accept(ClassPath.ClassInfo ci) { final Class clazz = ci.load(); if (!ignoreDeprecated(clazz)) core.addNode(clazz.getName()).setLabel(clazz.getSimpleName()).setComment(clazz.getSimpleName()); }//w w w. java 2 s . c om }); }
From source file:com.zuppelli.living.docs.DomainDiagramMojo.java
@Override protected void populateAssociations(ImmutableSet<ClassPath.ClassInfo> allClasses, final DotGraph.Digraph digraph) { Stream<ClassPath.ClassInfo> infra = allClasses.stream().filter(filterNot(getPrefix(), "domain")); infra.forEach(new ClassRelationshipConsumer(digraph, getShowDeprecated())); // then wire them together Stream<ClassPath.ClassInfo> domain = allClasses.stream().filter(filter(getPrefix(), "domain")); domain.forEach(new ClassRelationshipConsumer(digraph, getShowDeprecated())); }