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:nc.noumea.mairie.appock.services.impl.DemandeServiceImpl.java

@Override
public void repasseATraiter(List<Demande> listeDemande) {
    listeDemande.forEach(this::repasseATraiter);
}

From source file:com.redhat.red.build.koji.ExternalHttpClientTest.java

@Test
public void testGetTaskInfo_multiCall() throws Exception {
    List<Object> req1 = new ArrayList<>();
    req1.add(513598);//from  ww w  .j a  v  a  2 s  .  c om
    req1.add(true);

    List<Object> req2 = new ArrayList<>();
    req2.add(513599);
    req2.add(true);

    List<Object> args = new ArrayList<>();
    args.add(req1);
    args.add(req2);
    List<KojiTaskInfo> ret = client.multiCall(GET_TASK_INFO, args, KojiTaskInfo.class, null);
    ret.forEach(kojiTaskInfo -> {
        System.out.println(">>> " + kojiTaskInfo.getTaskId());
        assertTrue(kojiTaskInfo.getTaskId() == 513598 || kojiTaskInfo.getTaskId() == 513599);
    });
}

From source file:com.anevis.jfreechartsamplespring.chart.ChartServiceImpl.java

private JFreeChart createRingChart() {
    List<RingChartData> dataList = ringChartDataRepository.findAll();
    DefaultPieDataset dataSet = new DefaultPieDataset();

    dataList.forEach(data -> dataSet.setValue(data.getSecurity(), data.getWeighting()));

    JFreeChart chart = ChartFactory.createRingChart("", dataSet, true, false, Locale.GERMANY);

    return chart;
}

From source file:com.netflix.spinnaker.clouddriver.artifacts.helm.IndexParser.java

private List<String> findUrlsByVersion(List<EntryConfig> configs, String version) {
    List<String> urls = new ArrayList<>();
    configs.forEach(e -> {
        if (e.getVersion().equals(version)) {
            urls.addAll(e.getUrls());/* ww w  .j  a v a  2 s. c  om*/
        }
    });
    if (urls.isEmpty()) {
        throw new IllegalArgumentException("Could not find correct entry with artifact version " + version);
    }
    return urls;
}

From source file:org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher.java

private void addAttachments(String contentId, List<String> attachments) {
    attachments.forEach(attachment -> addOrUpdateAttachment(contentId, attachment));
}

From source file:com.qq.tars.service.server.ServerService.java

@Transactional(rollbackFor = { Exception.class })
public ServerConf addServerConf(DeployServer deployServer) {
    ServerConf serverConf = new ServerConf();
    BeanUtils.copyProperties(deployServer, serverConf);
    serverConf.setEnableSet(deployServer.isEnableSet() ? "Y" : "N");
    serverConf.setPosttime(DateTime.now());
    serverMapper.insertServerConf(serverConf);

    List<DeployAdapter> adapters = deployServer.getAdapters();
    adapters.forEach(servant -> {
        AdapterConf adapterConf = new AdapterConf();
        BeanUtils.copyProperties(servant, adapterConf);

        adapterConf.setApplication(serverConf.getApplication());
        adapterConf.setServerName(serverConf.getServerName());
        adapterConf.setNodeName(serverConf.getNodeName());

        adapterConf.setEndpoint(String.format("%s -h %s -t 60000 -p %s", servant.getPortType(),
                servant.getBindIp(), servant.getPort()));

        adapterConf.setServant(String.format("%s.%s.%s", adapterConf.getApplication(),
                adapterConf.getServerName(), servant.getObjName()));

        adapterConf.setAdapterName(String.format("%sAdapter", adapterConf.getServant()));

        adapterConf.setPosttime(DateTime.now());
        adapterMapper.insertAdapterConf(adapterConf);
    });/*from   w  w  w  . j ava 2  s .  c om*/

    // ??
    configService.addDefaultNodeConfigFile(serverConf.getApplication(), serverConf.getServerName(),
            serverConf.getNodeName(), "Y".equals(serverConf.getEnableSet()), serverConf.getSetName(),
            serverConf.getSetArea(), serverConf.getSetGroup());
    return serverConf;
}

From source file:org.tomitribe.tribestream.registryng.bootstrap.Provisioning.java

private void doSeeding(final File f) {

    // before seeding, start wiping out all the applications and endpoints
    final List<OpenApiDocument> apps = repository.findAllApplications();
    apps.forEach(d -> repository.deleteApplication(d.getId()));

    Stream.of(ofNullable(f.listFiles((dir, name) -> name.endsWith(".json"))).orElseGet(() -> new File[0]))
            .forEach(this::seedFile);
}

From source file:com.netflix.spinnaker.front50.migrations.LinearToParallelMigration.java

private void migrate(ItemDAO<Pipeline> dao, String type, Pipeline pipeline) {
    log.info(format("Migrating %s '%s' from linear -> parallel", type, pipeline.getId()));

    AtomicInteger refId = new AtomicInteger(0);
    List<Map<String, Object>> stages = (List<Map<String, Object>>) pipeline.getOrDefault("stages",
            Collections.emptyList());
    stages.forEach(stage -> {
        stage.put("refId", String.valueOf(refId.get()));
        if (refId.get() > 0) {
            stage.put("requisiteStageRefIds", Collections.singletonList(String.valueOf(refId.get() - 1)));
        } else {/*from w ww.j  a  va 2s.c o  m*/
            stage.put("requisiteStageRefIds", Collections.emptyList());
        }

        refId.incrementAndGet();
    });

    pipeline.put("parallel", true);
    dao.update(pipeline.getId(), pipeline);

    log.info(format("Migrated %s '%s' from linear -> parallel", type, pipeline.getId()));
}

From source file:business.UploadTests.java

protected void printFiles(List<FileRepresentation> files) {
    files.forEach(f -> {
        printFile(f);
    });
}

From source file:de.ks.idnadrev.information.view.InformationOverviewDS.java

@Override
public List<InformationPreviewItem> loadModel(Consumer<List<InformationPreviewItem>> furtherProcessing) {
    List<Class<? extends Information<?>>> classes = new ArrayList<>(
            Arrays.asList(TextInfo.class, ChartInfo.class, UmlDiagramInfo.class));
    if (loadingHint.getType() != null) {
        classes.clear();//from w w w  . j a v  a 2 s . c  om
        classes.add(loadingHint.getType());
    }
    String name = "%" + StringUtils.replace(loadingHint.getName(), "*", "%") + "%";
    List<String> tags = loadingHint.getTags();
    Category category = loadingHint.getCategory();

    List<InformationPreviewItem> retval = PersistentWork.read(em -> {
        CriteriaBuilder builder = em.getCriteriaBuilder();

        List<InformationPreviewItem> items = new ArrayList<>();

        for (Class<? extends Information<?>> clazz : classes) {
            List<InformationPreviewItem> results = getResults(name, tags, category, em, builder, clazz);
            results.forEach(r -> r.setType(clazz));
            items.addAll(results);
        }
        furtherProcessing.accept(items);
        return items;
    });

    return retval;
}