Example usage for java.util List forEach

List of usage examples for java.util List forEach

Introduction

In this page you can find the example usage for java.util List forEach.

Prototype

default void forEach(Consumer<? super T> action) 

Source Link

Document

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

Usage

From source file:org.kawakicchi.bookshelf.application.internal.DefaultViewerService.java

@Override
public List<BookEntity> getBookList() {
    final Viewer viewer = Viewer.getViewer();

    final List<Book> bookList = viewer.getBookList(bookRepository);

    final List<BookEntity> result = new ArrayList<BookEntity>();
    bookList.forEach(book -> result.add(new BookEntity(book)));
    return result;
}

From source file:org.kawakicchi.bookshelf.application.internal.DefaultViewerService.java

@Override
public List<PageEntity> getPageList(Long bookSeq) {
    final Viewer viewer = Viewer.getViewer();

    final Book book = viewer.getBook(new Sequence<Book>(bookSeq), bookRepository);

    final List<Page> pageList = book.getPageList(bookRepository);

    final List<PageEntity> result = new ArrayList<PageEntity>();
    pageList.forEach(page -> result.add(new PageEntity(page)));
    return result;
}

From source file:com.ibm.watson.catalyst.jumpqa.template.PatternTemplate.java

@Override
protected List<IGroundTruthEntry> candidates2entries(List<Candidate> candidates) {
    final List<IGroundTruthEntry> result = new ArrayList<IGroundTruthEntry>();
    candidates.forEach((c) -> result.addAll(candidate2entries(c)));
    return result;
}

From source file:org.kawakicchi.bookshelf.application.internal.DefaultViewerService.java

@Override
public List<BookEntity> getBookList(final Long seriesSeq) {
    final Viewer viewer = Viewer.getViewer();

    final Series series = viewer.getSeries(new Sequence<Series>(seriesSeq), bookRepository);

    final List<Book> bookList = series.getBookList(bookRepository);

    final List<BookEntity> result = new ArrayList<BookEntity>();
    bookList.forEach(book -> result.add(new BookEntity(book)));
    return result;
}

From source file:eu.over9000.cathode.Dispatcher.java

private void handleParameters(final RequestBuilder requestBuilder, final Parameter[] parameters) {
    for (final Parameter parameter : parameters) {
        if (parameter != null) {
            final List<NameValuePair> nameValuePairs = parameter.buildParamPairs();
            nameValuePairs.forEach(requestBuilder::addParameter);
        }//from w  w  w . j av  a2 s  .  c  om
    }
}

From source file:de.qaware.chronix.solr.compaction.SolrFacetService.java

/**
 * <p>//w  ww. j a va2 s  .c  o m
 * Converts the pivot table of {@link #pivot(String, Query)} into a list of time series IDs.
 * A concrete and specific time series is identified by a full path through all pivot dimensions. E.g.:
 * <p>
 * Input:
 * -----
 * host: h01
 * pivot:
 * ..metric: cpu
 * ..metric: heap
 * ..pivot:
 * ....process: java
 * ....process: php
 * host: h02
 * ..metric: cpu
 * ..pivot:
 * ....process: java
 * <p>
 * Output:
 * ------
 * [host: h01, metric: cpu]
 * [host: h01, metric: heap, process:java]
 * [host: h01, metric: heap, process:php]
 * [host: h02, metric: cpu, process:java]
 *
 * @param attributes pivot result
 * @return time series ids
 */
public List<TimeSeriesId> toTimeSeriesIds(List<NamedList<Object>> attributes) {
    List<TimeSeriesId> result = new ArrayList<>();
    attributes.forEach(it -> toTimeSeriesIds(it, result, new HashMap<>()));
    return result;
}

From source file:ee.ria.xroad.commonui.OptionalPartsConf.java

/**
 * Creates optional parts configuration.
 *
 * @param confDir - directory, where optional part files are in.
 * @throws IOException - when optional parts directory cannot be read.
 *///  ww w . j av a2  s . com
public OptionalPartsConf(String confDir) throws IOException {
    File optionalPartsDir = new File(confDir);

    final String optionalPartsPath = optionalPartsDir.getAbsolutePath();

    if (!optionalPartsDir.isDirectory()) {
        log.warn("Optional configuration parts directory '{}' " + "either does not exist or is regular file",
                optionalPartsPath);
        return;
    }

    log.debug("Getting optional conf parts from directory '{}'", confDir);

    File[] optionalPartFiles = optionalPartsDir.listFiles(getIniFileFilter());

    if (optionalPartFiles == null) {
        log.warn("Optional part files list in directory '{}' " + "cannot be fetched.", optionalPartsPath);
        return;
    }

    List<File> files = Arrays.asList(optionalPartFiles);

    files.forEach(this::processFile);
}

From source file:com.kumuluz.ee.security.KeycloakSecurityConfigurationUtilImpl.java

private List<ConstraintMapping> toConstraintMappings(List<SecurityConstraint> constraints) {
    List<ConstraintMapping> constraintMappings = new ArrayList<>();
    constraints.forEach(constraint -> constraintMappings.add(toConstraintMapping(constraint)));
    return constraintMappings;
}

From source file:com.blackducksoftware.integration.hub.detect.detector.pear.PearParser.java

List<String> findDependencyNames(final List<String> content) {
    final List<String> nameList = new ArrayList<>();

    if (content.size() > 5) {
        final List<String> listing = content.subList(5, content.size() - 1);
        listing.forEach(line -> {
            final String[] dependencyInfo = splitIgnoringWhitespace(line, " ");

            final String dependencyName = dependencyInfo[2].trim();
            final String dependencyRequired = dependencyInfo[0].trim();

            if (StringUtils.isNotBlank(dependencyName)) {
                if (!detectConfiguration.getBooleanProperty(DetectProperty.DETECT_PEAR_ONLY_REQUIRED_DEPS,
                        PropertyAuthority.None)) {
                    nameList.add(last(dependencyName.split("/")));
                } else {
                    if (BooleanUtils.toBoolean(dependencyRequired)) {
                        nameList.add(last(dependencyName.split("/")));
                    }/*from  w w  w .  j  a  v  a2 s .com*/
                }
            }
        });
    }

    return nameList;

}

From source file:fi.helsinki.opintoni.service.portfolio.DegreeService.java

public List<DegreeDto> updateDegrees(Long portfolioId, List<UpdateDegree> updateDegrees) {
    Portfolio portfolio = portfolioRepository.findOne(portfolioId);

    degreeRepository.delete(degreeRepository.findByPortfolioId(portfolio.id));

    updateDegrees.forEach(updateDegree -> {
        Degree degree = new Degree();
        degree.title = updateDegree.title;
        degree.description = updateDegree.description;
        degree.dateOfDegree = updateDegree.dateOfDegree;
        degree.portfolio = portfolio;/* w  w  w .  j  a v  a 2s  .  c  om*/
        degreeRepository.save(degree);
    });

    return getDtos(portfolioId, degreeRepository::findByPortfolioId, degreeConverter::toDto);
}