List of usage examples for java.util Set stream
default Stream<E> stream()
From source file:ddf.catalog.transformer.csv.CsvQueryResponseTransformer.java
private List<AttributeDescriptor> sortAttributes(final Set<AttributeDescriptor> attributeSet, final List<String> attributeOrder) { CsvAttributeDescriptorComparator attributeComparator = new CsvAttributeDescriptorComparator(attributeOrder); return attributeSet.stream().sorted(attributeComparator).collect(Collectors.toList()); }
From source file:alfio.manager.SpecialPriceManager.java
public List<SendCodeModification> linkAssigneeToCode(List<SendCodeModification> input, String eventName, int categoryId, String username) { final Event event = eventManager.getSingleEvent(eventName, username); Set<SendCodeModification> set = new LinkedHashSet<>(input); List<String> availableCodes = checkCodeAssignment(set, categoryId, event, username); final Iterator<String> codes = availableCodes.iterator(); return Stream.concat(set.stream().filter(IS_CODE_PRESENT), input.stream().filter(IS_CODE_PRESENT.negate()) .map(p -> new SendCodeModification(codes.next(), p.getAssignee(), p.getEmail(), p.getLanguage()))) .collect(toList());/*from ww w . j a v a2s . com*/ }
From source file:de.ks.flatadocdb.defaults.ReflectionLuceneDocumentExtractor.java
protected Set<DocField> getFields(Class<?> clazz) { if (!cache.containsKey(clazz)) { @SuppressWarnings("unchecked") Set<Field> allFields = ReflectionUtils.getAllFields(clazz, this::filterField); Set<DocField> docFields = allFields.stream().map(this::createDocField).filter(Objects::nonNull) .collect(Collectors.toSet()); docFields.forEach(// ww w . java2 s .c o m f -> log.debug("Found indexable lucene field {} for {}", f.getField(), clazz.getSimpleName())); cache.putIfAbsent(clazz, docFields); } return cache.get(clazz); }
From source file:ddf.catalog.transformer.csv.common.CsvTransformerTest.java
@Test public void getAllCsvAttributeDescriptors() { Set<AttributeDescriptor> allAttributes = CsvTransformer.getAllCsvAttributeDescriptors(metacardList); assertThat(allAttributes, hasSize(6)); Set<String> allAttributeNames = allAttributes.stream().map(AttributeDescriptor::getName) .collect(Collectors.toSet()); // Binary and Object types are filtered final Set<String> expectedAttributes = Sets.newHashSet("attribute1", "attribute2", "attribute3", "attribute4", "attribute5", "attribute6"); assertThat(allAttributeNames, is(expectedAttributes)); }
From source file:io.fabric8.vertx.maven.plugin.utils.PackageHelper.java
/** * *///from ww w .j a va2s .com protected void addDependencies() { Set<Optional<File>> all = new LinkedHashSet<>(compileAndRuntimeDeps); all.addAll(transitiveDeps); all.stream().filter(Optional::isPresent).forEach(dep -> { File f = dep.get(); if (log.isDebugEnabled()) { log.debug("Adding Dependency :" + f.toString()); } this.archive.as(ZipImporter.class).importFrom(f); }); }
From source file:com.blackducksoftware.integration.hub.detect.detector.clang.ClangExtractor.java
private Function<CompileCommand, Stream<String>> compileCommandToDependencyFilePathsConverter( final File workingDir) { boolean cleanup = detectConfiguration == null ? true : detectConfiguration.getBooleanProperty(DetectProperty.DETECT_CLEANUP, PropertyAuthority.None); return (final CompileCommand compileCommand) -> { logger.info(String.format("Analyzing source file: %s", compileCommand.getFile())); final Set<String> dependencyFilePaths = dependenciesListFileManager .generateDependencyFilePaths(workingDir, compileCommand, cleanup); return dependencyFilePaths.stream(); };//ww w . j a va 2s. c o m }
From source file:com.yahoo.elide.parsers.state.CollectionTerminalState.java
private Data getData(RequestScope requestScope, Set<PersistentResource> collection) { User user = requestScope.getUser();//from w w w. java2s .co m Preconditions.checkNotNull(collection); Preconditions.checkNotNull(user); List<Resource> resources = collection.stream().map(PersistentResource::toResource) .collect(Collectors.toList()); return new Data<>(resources); }
From source file:com.amazonaws.util.awsclientgenerator.transform.C2jModelToGeneratorModelTransformer.java
Set<Error> filterOutCoreErrors(Set<Error> errors) { return errors.stream().filter(e -> !CoreErrors.VARIANTS.contains(e.getName())).collect(Collectors.toSet()); }
From source file:com.github.gavlyukovskiy.boot.jdbc.decorator.flexypool.FlexyPoolConfigurationTests.java
@SuppressWarnings("unchecked") private <T extends ConnectionAcquiringStrategy> T findStrategy(FlexyPoolDataSource<?> flexyPoolDataSource, Class<T> factoryClass) { Field field = ReflectionUtils.findField(FlexyPoolDataSource.class, "connectionAcquiringStrategies"); ReflectionUtils.makeAccessible(field); Set<ConnectionAcquiringStrategy> strategies = (Set<ConnectionAcquiringStrategy>) ReflectionUtils .getField(field, flexyPoolDataSource); return (T) strategies.stream().filter(factoryClass::isInstance).findFirst().orElse(null); }
From source file:com.thinkbiganalytics.metadata.modeshape.user.JcrUserGroup.java
private Stream<Node> streamAllContainingGroupNodes(Node groupNode) { Set<Node> referenced = JcrPropertyUtil.<Node>getSetProperty(groupNode, JcrUserGroup.GROUPS); return Stream.concat(referenced.stream(), referenced.stream().flatMap(node -> streamAllContainingGroupNodes(node))); }