List of usage examples for java.lang Iterable spliterator
default Spliterator<T> spliterator()
From source file:edu.pitt.dbmi.ccd.db.service.GroupService.java
public List<Group> findByNames(Iterable<String> names) { return StreamSupport.stream(names.spliterator(), false).map(this::findByName).collect(Collectors.toList()); }
From source file:io.wcm.devops.conga.generator.plugins.handlebars.helper.AbstractEachIfHelper.java
/** * Filter iterable to contain only items that have any value set for the given property name. * @param items Items//from w ww . ja v a2s . co m * @param propertyName Property name * @param options Options * @return Filtered items */ private Iterable<Object> filterIterable(Iterable<Object> items, String propertyName, Options options) { return StreamSupport.stream(items.spliterator(), false).filter(item -> item != null) .filter(item -> checkProperty(item, propertyName, options)).collect(Collectors.toList()); }
From source file:fi.vrk.xroad.catalog.persistence.TestUtil.java
public Optional getEntity(Iterable entities, Long l) { return StreamSupport.stream(entities.spliterator(), false).filter(e -> getIdentifier(e).equals(l)) .findFirst();//from w w w .j a v a 2s. c om }
From source file:com.github.lothar.security.acl.elasticsearch.repository.AclElasticsearchRepository.java
private List<String> stringIdsRepresentation(Iterable<ID> ids) { Assert.notNull(ids, "ids can't be null."); return stream(ids.spliterator(), false) // .map(id -> stringIdRepresentation(id)) // .collect(toList());/*from w w w . ja v a 2 s . c om*/ }
From source file:com.rationaldevelopers.oss.service.CacheService.java
@Scheduled(fixedRate = 60000) public void trueUpCache() { if (!lock.isLocked()) { lock.lock();//w w w . jav a 2s . c o m try { LOGGER.info("Running Timed Task"); final Iterable<SimpleItem> all = simpleItemService.findAll(); final AtomicInteger itemsUpdated = new AtomicInteger(0); StreamSupport.stream(all.spliterator(), false).filter(i -> !cache.containsKey(i.getSid()) || cache.containsKey(i.getSid()) && !cache.get(i.getSid()).equals(i)).forEach(i -> { cache.put(i.getSid(), i); itemsUpdated.incrementAndGet(); }); LOGGER.info("Total Items Updated: {}", itemsUpdated.get()); } finally { lock.unlock(); } } }
From source file:edu.pitt.dbmi.ccd.anno.group.GroupResourceAssembler.java
/** * convert Groups to GroupResources/* ww w . j av a 2 s .c o m*/ * * @param groups entities * @return List of resources */ @Override public List<GroupResource> toResources(Iterable<? extends Group> groups) throws IllegalArgumentException { // Assert groups is not empty Assert.isTrue(groups.iterator().hasNext()); return StreamSupport.stream(groups.spliterator(), false).map(this::toResource).collect(Collectors.toList()); }
From source file:edu.pitt.dbmi.ccd.anno.access.AccessResourceAssembler.java
/** * Convert Accesses to AccessResources//from ww w . ja v a2s .c o m * * @param accesses entities * @return list of resources */ @Override public List<AccessResource> toResources(Iterable<? extends Access> accesses) throws IllegalArgumentException { // Assert accesses is not empty Assert.isTrue(accesses.iterator().hasNext()); return StreamSupport.stream(accesses.spliterator(), false).map(this::toResource) .collect(Collectors.toList()); }
From source file:com.epam.ta.reportportal.events.handler.ExternalSystemActivityHandler.java
@EventListener public void onProjectExternalSystemsDelete(ProjectExternalSystemsDeletedEvent event) { Iterable<ExternalSystem> externalSystems = event.getExternalSystems(); if (null != externalSystems) { List<Activity> activities = StreamSupport.stream(externalSystems.spliterator(), false) .map(externalSystem -> { String name = externalSystem.getExternalSystemType().name() + ":" + externalSystem.getProject(); return activityBuilder.get().addObjectName(name).addObjectType(EXTERNAL_SYSTEM) .addLoggedObjectRef(externalSystem.getId()).addUserRef(event.getDeletedBy()) .addActionType(DELETE).addProjectRef(event.getProject()).build(); }).collect(Collectors.toList()); if (!activities.isEmpty()) activityRepository.save(activities); }//w w w .j av a 2 s.c o m }
From source file:com._4dconcept.springframework.data.marklogic.repository.support.SimpleMarklogicRepository.java
@Override public List<T> findAllById(Iterable<ID> ids) { return StreamSupport.stream(ids.spliterator(), false).map(this::findById).filter(Optional::isPresent) .map(Optional::get).collect(Collectors.toList()); }
From source file:com.yoshio3.services.StorageService.java
public List<BlobStorageEntity> getAllFiles() { List<BlobStorageEntity> entity = new ArrayList<>(); try {/*from w w w . j a v a 2 s. co m*/ CloudBlobContainer container = blobClient.getContainerReference(CONTAINER_NAME_FOR_UPLOAD); Iterable<ListBlobItem> items = container.listBlobs(); Spliterator<ListBlobItem> spliterator = items.spliterator(); Stream<ListBlobItem> stream = StreamSupport.stream(spliterator, false); List<CloudBlob> blockBlob = stream.filter(item -> item instanceof CloudBlob) .map(item -> (CloudBlob) item).collect(Collectors.toList()); entity = blockBlob.stream().map(blob -> convertEntity(blob)).collect(Collectors.toList()); } catch (URISyntaxException | StorageException ex) { LOGGER.log(Level.SEVERE, "", ex); } return entity; }