List of usage examples for java.lang Iterable forEach
default void forEach(Consumer<? super T> action)
From source file:org.arrow.runtime.meta.MapProcessMetaDataRepository.java
/** * {@inheritDoc}/*from w w w. j a va 2 s .c o m*/ */ @Override public void saveAll(Iterable<ProcessMetaData> iterable) { iterable.forEach(this::save); }
From source file:de.kaiserpfalzEdv.office.core.security.impl.SecurityTicketHousekeeping.java
@Scheduled(fixedRate = 60000L, initialDelay = 60000L) public void deleteOldTickets() { LOG.info("Removing invalid tickets."); Iterable<SecurityTicket> tickets = retrieveInvalideTickets(); tickets.forEach(t -> removeInvalidTicket(t)); }
From source file:example.springdata.jpa.compositions.FlushOnSaveRepositoryImpl.java
@Transactional @Override//ww w . j a v a2 s . co m public <S extends T> Iterable<S> saveAll(Iterable<S> entities) { entities.forEach(this::doSave); entityManager.flush(); return entities; }
From source file:com.github.jskarulis.dealsentry.HomeController.java
@RequestMapping(value = "/countries", method = RequestMethod.GET) public List<Country> findAll() { final List<Country> countryList = new ArrayList<>(); final Iterable<Country> countries = countryRepository.findAll(); countries.forEach(new Consumer<Country>() { @Override/*w w w . j a va 2 s .c o m*/ public void accept(Country country) { countryList.add(country); } }); return countryList; }
From source file:com.lofidewanto.demo.server.service.person.PersonServiceImpl.java
@Override public Collection<Person> findAllPersons(Integer start, Integer length) { Collection<Person> personsAsCollection = new ArrayList<>(); Pageable pageable = new PageRequest(start, length); Iterable<PersonImpl> persons = personRepository.findAll(pageable); persons.forEach(person -> { personsAsCollection.add(person); });/*from www . j a va 2 s .c o m*/ logger.info("Find all persons with start and length amount: " + personsAsCollection.size()); return personsAsCollection; }
From source file:com.github.cbismuth.fdupes.io.PathOrganizer.java
private void moveUniqueFiles(final Path destination, final Iterable<PathElement> uniqueElements) { final AtomicInteger counter = new AtomicInteger(1); uniqueElements.forEach(pathElement -> { final Optional<Path> timestampPath = pathAnalyser.getTimestampPath(destination, pathElement.getPath()); if (timestampPath.isPresent()) { onTimestampPath(pathElement, timestampPath.get()); } else {/* ww w .ja v a 2 s .c o m*/ onNoTimestampPath(destination, pathElement, counter); } }); }
From source file:org.obiba.mica.core.service.SchemaFormContentFileService.java
private void saveFiles(Iterable files, String entityPath) { if (files != null) files.forEach(file -> { LinkedHashMap map = (LinkedHashMap) file; map.put("path", entityPath); fileStoreService.save(map.get("id").toString()); });/*w w w .ja va 2 s .com*/ }
From source file:org.hostdiscovery.app.Hostdiscommand.java
private JsonNode json(Iterable<Host> hosts) { ObjectMapper mapper = new ObjectMapper(); ArrayNode result = mapper.createArrayNode(); hosts.forEach(host -> result.add(jsonForEntity(host, Host.class))); return result; }
From source file:zipkin.server.ActuateCollectorMetrics.java
@Override public Collection<Metric<?>> metrics() { final Iterable<Metric<?>> metrics = reader.findAll(); final List<Metric<?>> result = new ArrayList<>(); metrics.forEach(result::add); return result; }
From source file:org.obiba.mica.dataset.search.VariableIndexer.java
private void indexDatasetVariables(String indexName, Iterable<DatasetVariable> variables) { List<DocumentSet> documentSets = variableSetService.getAll(); variables.forEach(variable -> documentSets.forEach(ds -> { if (ds.getIdentifiers().contains(variable.getId())) variable.addSet(ds.getId()); }));/*from w ww. java2s .co m*/ indexer.indexAllIndexables(indexName, variables); }