List of usage examples for java.util List forEach
default void forEach(Consumer<? super T> action)
From source file:com.ibm.watson.catalyst.jumpqa.template.ATemplate.java
/** * TODO: Method description//from www.j a v a2 s . com * * @param candidates * @return */ protected List<IGroundTruthEntry> candidates2entries(List<Candidate> candidates) { final List<IGroundTruthEntry> result = new ArrayList<IGroundTruthEntry>(); candidates.forEach((candidate) -> result.addAll(candidate2entries(candidate))); return result; }
From source file:com.ibm.watson.catalyst.jumpqa.template.ATemplate.java
/** * Generates matches from a list of strings. * /*from w w w . j a v a 2 s . co m*/ * @param strings the strings to iterate through * @return */ protected final List<IGroundTruthEntry> genMatchesFromStrings(final Pau aPau, final List<String> strings) { final List<IGroundTruthEntry> result = new ArrayList<IGroundTruthEntry>(); strings.forEach((s) -> result.addAll(genEntriesFromString(s, aPau))); return result; }
From source file:musiccrawler.Crawler.java
public List<String> getListStream(List<String> musicIds, String path) { String baseDomain = Constant.URLConst.BASE_DOMAIN; List<String> streams = new ArrayList<>(); if (musicIds != null && !musicIds.isEmpty()) { musicIds.forEach(id -> { String url = baseDomain + String.format(Constant.URLConst.URL_MUSIC_TEMP, path, id); String stream = service.getLinkStream(url, true).getStream(); streams.add(stream);//from w w w. ja va 2s . c o m }); } return streams; }
From source file:app.service.CollectionService.java
public List<Collection> findByUrl(@Nullable String uid, String url, int page, int size, Sort sort) { Link link = mLinkRepo.findFirstByUrl(url); Page<Collection> colPage = mColRepo.findByLink(link, new PageRequest(page, size, sort)); List<Collection> colList = getFromPage(colPage, true); colList.forEach(collection -> fillCollection(collection, uid)); return colList; }
From source file:com.cybernostics.jsp2thymeleaf.api.expressions.ExpressionWalker.java
private void walkBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, ExpressionVisitor v) {/* w w w .j a v a 2s . c om*/ v.visitBinaryOperatorExpressionStart(binaryOperatorExpression); walkExpression(binaryOperatorExpression.getExpression(), v); List<Pair<? extends BinaryOperator, ? extends Expression>> pairs = v .getBinaryOperatorOperatorExpressionPairs(binaryOperatorExpression); pairs.forEach(pair -> { walkBinaryOperator((BinaryOperator) pair.getLeft(), v); walkExpression((Expression) pair.getRight(), v); }); v.visitBinaryOperatorExpressionEnd(binaryOperatorExpression); }
From source file:uk.ac.kcl.iop.brc.core.pipeline.dncpipeline.data.PatientDao.java
private void setDateOfBirths(Patient patient) { SessionWrapper sessionWrapper = getCurrentSourceSession(); try {//w w w.j a va 2s. co m Query getDateOfBirths = sessionWrapper.getNamedQuery("getDateOfBirths"); getDateOfBirths.setParameter("patientId", patient.getId()); List dateOfBirths = getDateOfBirths.list(); dateOfBirths.forEach(object -> { Date dateOfBirth; if (object instanceof Date) { dateOfBirth = (Date) object; } else { Object[] dateOfBirthRow = (Object[]) object; dateOfBirth = (Date) dateOfBirthRow[0]; } if (dateOfBirth != null) { patient.addDateOfBirth(dateOfBirth); } }); } catch (Exception ex) { logger.warn("Error while loading date of births of patient " + patient.getId() + ". Does the specified table exist? " + ex.getMessage()); } finally { sessionWrapper.closeSession(); } }
From source file:de.qaware.chronix.solr.compaction.SolrFacetService.java
private void toTimeSeriesIds(NamedList<Object> attributes, List<TimeSeriesId> output, Map<String, Object> tsId) { tsId.put((String) attributes.get(FIELD_KEY), attributes.get(VALUE_KEY)); if (attributes.get(PIVOT_KEY) != null) { @SuppressWarnings("unchecked") List<NamedList<Object>> listOfAttributes = (List) attributes.get(PIVOT_KEY); listOfAttributes.forEach(it -> toTimeSeriesIds(it, output, new HashMap<>(tsId))); } else {//from w ww . java 2 s. c o m output.add(new TimeSeriesId(tsId)); } }
From source file:com.nike.cerberus.service.MetaDataService.java
protected Map<String, String> getRoleIdToStringMap() { List<RoleRecord> roleRecords = roleDao.getAllRoles(); Map<String, String> roleIdToStringMap = new HashMap<>(roleRecords.size()); roleRecords.forEach(roleRecord -> roleIdToStringMap.put(roleRecord.getId(), roleRecord.getName())); return roleIdToStringMap; }
From source file:app.service.CollectionService.java
public List<Collection> findByUser(String uid, int page, int size) { if (StringUtils.isEmpty(uid)) { return null; }/*from w w w . j a v a 2 s.co m*/ User user = prepareUser(uid); Page<Collection> colPage = mColRepo.findByUser(user, new PageRequest(page, size, mLatestSort)); List<Collection> colList = getFromPage(colPage, false); colList.forEach(collection -> fillCollection(collection, uid)); return colList; }