List of usage examples for java.lang Iterable spliterator
default Spliterator<T> spliterator()
From source file:org.bozzo.ipplan.domain.model.ui.InfrastructureResource.java
/** * @param id//from www . j a v a 2s . com * @param description * @param crm * @param group */ @JsonCreator public InfrastructureResource(@JsonProperty("id") Integer id, @JsonProperty String description, @JsonProperty String crm, @JsonProperty String group, @JsonProperty Iterable<Zone> zones, @JsonProperty Iterable<Subnet> subnets) { this.id = id; this.description = description; this.crm = crm; this.group = group; if (zones != null) { this.setZones(StreamSupport.stream(zones.spliterator(), true).map(new ToZoneResourceFunction())); } if (subnets != null) { this.setSubnets(StreamSupport.stream(subnets.spliterator(), true).map(new ToSubnetResourceFunction())); } }
From source file:com.epam.ta.reportportal.database.dao.TestItemRepositoryCustomImpl.java
private Collection<String> obtainIds(Iterable<Launch> launches) { return StreamSupport.stream(launches.spliterator(), false).map(Launch::getId).collect(toList()); }
From source file:com.epam.dlab.backendapi.dao.BaseDAO.java
protected Stream<Document> stream(Iterable<Document> iterable) { return StreamSupport.stream(iterable.spliterator(), false); }
From source file:edu.cmu.cs.lti.discoursedb.annotation.lightside.io.LightSideService.java
/** * Exports annotations on contributions associated with any of the provided DiscourseParts into * the provided output file./* ww w . ja va2 s. co m*/ * * @param discourseParts the discourse parts to extract contributions from * @param outputFile file to write the annotations to */ @Transactional(readOnly = true) public void exportAnnotations(Iterable<DiscoursePart> discourseParts, File outputFile) { List<RawDataInstance> data = StreamSupport.stream(discourseParts.spliterator(), false) .flatMap(dp -> extractAnnotations(dp).stream()).collect(Collectors.toList()); try { FileUtils.writeStringToFile(outputFile, generateLightSideOutput(data)); } catch (IOException e) { log.error("Error writing LightSide file to disk", e); } }
From source file:org.bozzo.ipplan.domain.model.ui.RangeResource.java
/** * @param id/*from w w w . j a v a2 s. co m*/ * @param ip * @param size * @param description * @param zoneId * @param infraId */ @JsonCreator public RangeResource(@JsonProperty("id") Long id, @JsonProperty Long ip, @JsonProperty Long size, @JsonProperty Integer netmask, @JsonProperty String description, @JsonProperty Long zoneId, @JsonProperty Integer infraId, @JsonProperty Iterable<Subnet> subnets) { super(); this.id = id; this.ip = ip; this.size = size; this.netmask = netmask; this.description = description; this.zoneId = zoneId; this.infraId = infraId; if (subnets != null) { this.setSubnets(StreamSupport.stream(subnets.spliterator(), true).map(new ToSubnetResourceFunction())); } }
From source file:org.obiba.mica.core.upgrade.Mica310Upgrade.java
private void addLostMethods(Study study) { Iterable<CommitInfo> commitInfos = individualStudyService.getCommitInfos(study); List<JSONObject> history = StreamSupport.stream(commitInfos.spliterator(), false) .map(commit -> individualStudyService.getFromCommitAsJson(study, commit.getCommitId())) .collect(toList());/*from w w w . j a va 2s . c o m*/ addRecruitmentsIfMissing(study, history); addMethodsIfMissing(study, history, "otherDesign"); addMethodsIfMissing(study, history, "followUpInfo"); addMethodsIfMissing(study, history, "otherRecruitment"); addMethodsIfMissing(study, history, "info"); }
From source file:com.joyent.manta.client.multipart.TestMultipartManager.java
@Override public void complete(TestMultipartUpload upload, Iterable<? extends MantaMultipartUploadTuple> parts) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); final Stream<? extends MantaMultipartUploadTuple> partsStream = StreamSupport.stream(parts.spliterator(), false);/* w w w .ja v a2 s .c o m*/ complete(upload, partsStream); }
From source file:com.yahoo.bard.webservice.config.ModuleLoader.java
/** * Get a stream of configurations in descending order of precedence given a list of dependent modules. * * @param dependentModules The list of modules which are depended on * * @return A stream of module configurations in descending order of precedence *//* w ww . j a v a 2s . c o m*/ public Stream<Configuration> getConfigurations(List<String> dependentModules) { LOG.debug("Resolving dependent modules: {}", dependentModules); ConfigurationGraph graph = loadConfigurationGraph(); Iterable<String> reverseList = () -> dependentModules.stream() .collect(Collectors.toCollection(LinkedList::new)).descendingIterator(); // Because we want the configurations in precedence order, process the dependent modules from right to left, // deduping redundant (repeated with lower precedence) dependencies return StreamSupport.stream(reverseList.spliterator(), false).flatMap(graph::preOrderRightToLeftTraversal) .distinct().map(graph::getConfiguration); }
From source file:com.epam.ta.reportportal.core.item.UpdateTestItemHandlerImpl.java
@Override public List<OperationCompletionRS> addExternalIssues(String projectName, AddExternalIssueRQ rq, String userName) {//from w w w . ja v a2s. c om List<String> errors = new ArrayList<>(); ExternalSystem extSystem = externalSystemRepository.findOne(rq.getExternalSystemId()); expect(extSystem, notNull()).verify(EXTERNAL_SYSTEM_NOT_FOUND, rq.getExternalSystemId()); Iterable<TestItem> testItems = testItemRepository.findAll(rq.getTestItemIds()); List<TestItem> before = SerializationUtils.clone(Lists.newArrayList(testItems)); StreamSupport.stream(testItems.spliterator(), false).forEach(testItem -> { try { verifyTestItem(testItem, testItem.getId()); Set<TestItemIssue.ExternalSystemIssue> tiIssues = rq.getIssues().stream() .filter(issue -> !issue.getTicketId().trim().isEmpty()) .map(TestItemUtils.externalIssueDtoConverter(rq.getExternalSystemId(), userName)) .collect(toSet()); if (null == testItem.getIssue().getExternalSystemIssues()) { testItem.getIssue().setExternalSystemIssues(tiIssues); } else { tiIssues.addAll(testItem.getIssue().getExternalSystemIssues()); testItem.getIssue().setExternalSystemIssues(tiIssues); } } catch (BusinessRuleViolationException e) { errors.add(e.getMessage()); } }); expect(!errors.isEmpty(), equalTo(FALSE)).verify(FAILED_TEST_ITEM_ISSUE_TYPE_DEFINITION, errors.toString()); testItemRepository.save(testItems); eventPublisher.publishEvent( new TicketAttachedEvent(before, Lists.newArrayList(testItems), userName, projectName)); return StreamSupport.stream(testItems.spliterator(), false).map(testItem -> new OperationCompletionRS( "TestItem with ID = '" + testItem.getId() + "' successfully updated.")).collect(toList()); }
From source file:com.linecorp.armeria.server.docs.DocService.java
/** * Creates a new instance, prepopulating debug forms with the provided {@code sampleRequests}. * {@code sampleRequests} should be a list of Thrift argument objects for methods that should be * prepopulated (e.g., a populated hello_args object for the hello method on HelloService). *//*ww w. j a v a 2 s. co m*/ public DocService(Iterable<? extends TBase<?, ?>> sampleRequests) { super(ofExact("/specification.json", HttpFileService.forVfs(new DocServiceVfs())), ofCatchAll(HttpFileService.forClassPath(DocService.class.getClassLoader(), "com/linecorp/armeria/server/docs"))); requireNonNull(sampleRequests, "sampleRequests"); this.sampleRequests = StreamSupport.stream(sampleRequests.spliterator(), false) .collect(Collectors.toMap(Object::getClass, Function.identity())); }