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:com.baidu.rigel.biplatform.tesseract.util.DataModelBuilder.java

/**
 * ????//w w  w  . ja v a  2  s . co m
 * 
 * @param treeNodes ??
 * @return
 */
public static List<HeadField> buildAxisHeadFields(List<MemberNodeTree> treeNodes,
        List<MiniCubeMeasure> measures) {
    List<HeadField> result = Lists.newArrayList();
    for (MemberNodeTree nodeTree : treeNodes) {
        List<HeadField> curHeadFields = buildFieldsByMemberNodeTree(nodeTree, result.isEmpty(), null);
        if (result.isEmpty()) {
            result.addAll(curHeadFields);
        } else {
            addTailFields(result, curHeadFields);
        }
    }
    // ??????
    if (CollectionUtils.isNotEmpty(measures)) {
        List<HeadField> measureFields = new ArrayList<HeadField>(measures.size());
        measures.forEach((measure) -> {
            HeadField measureField = new HeadField(null);
            measureField.setCaption(measure.getCaption());
            measureField.setValue(measure.getUniqueName());
            measureFields.add(measureField);
        });
        // 
        addTailFields(result, measureFields);
    }

    return result;
}

From source file:com.mec.DAO.Postgre.PostgreDAO.java

public List<OfertaTipo> getOfertas() {
    List<OfertaTipo> ofertas = get(OfertaTipo.class);
    ofertas.forEach((o) -> {
        Hibernate.initialize(o.getBase());
        Hibernate.initialize(o.getModalidad());
    });//from  w w  w.j  a v  a 2 s  . co m
    return ofertas;
}

From source file:musiccrawler.MusicCrawler.java

public List<Music> crawl(String path) {
    Crawler<Music> crawler = new Crawler(Constant.URLConst.BASE_DOMAIN + path).build();
    List<Music> musics = crawler.getMusicHotVn();
    musics.forEach(music -> {
        Map<String, Object> params = settingParams(music);
        objectDao.insert(resourceConstant.SQL_INSERT_OR_UPDATE_MUSIC,
                resourceConstant.SQL_INSERT_OR_UPDATE_SINGER, params);
    });//w  w w.ja  v a2 s .com
    return musics;
}

From source file:nl.knaw.huygens.alexandria.endpoint.resource.ResourceTextUploadEntity.java

private void handleSubLayerData(List<BaseLayerData> subLayerData) {
    subLayerData.forEach(sld -> {
        String xml = sld.getBaseLayer();
        this.annotationActions.add("adding subresource with text '" + xml + "'");
        this.annotationActions
                .addAll(sld.getAnnotationData().stream().map(AnnotationData::toVerbose).collect(toList()));
        handleSubLayerData(sld.getSubLayerData());
    });//from  www  .  ja  va  2s  .  c  o  m
}

From source file:com.asakusafw.runtime.directio.hadoop.HadoopDataSourceUtil.java

private static void cancel(List<? extends Future<?>> futures) {
    futures.forEach(f -> f.cancel(true));
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.file.ImageDisplay.java

public void setImages(List<File> files) {
    images.clear();//from w  ww .j av a2 s.c om
    files.forEach((f) -> {
        images.add(new FileResource(f));
    });
}

From source file:com.zxy.commons.mongodb.MongodbTest.java

@Test
public void delete() {
    List<User> users = mongoTemplate.findAll(User.class);
    users.forEach(user -> {
        mongoTemplate.remove(user);//from ww  w.  j  av a2s.c om
    });
}

From source file:com.zxy.commons.mongodb.MongodbTest.java

@Test
public void find() {
    List<User> users = mongoTemplate.findAll(User.class);
    users.forEach(user -> {
        User u = mongoTemplate.findOne(new Query(where("_id").is(user.getId())), User.class);
        System.out.println(u.getId());
    });//w ww . j  a va2 s  .  com
}

From source file:org.obiba.mica.taxonomy.TaxonomyIndexer.java

private void index(TaxonomyTarget target, List<Taxonomy> taxonomies) {
    taxonomies.forEach(taxo -> {
        indexer.index(Indexer.TAXONOMY_INDEX, new TaxonomyIndexable(target, taxo));
        if (taxo.hasVocabularies())
            taxo.getVocabularies().forEach(voc -> {
                indexer.index(Indexer.TAXONOMY_INDEX, new TaxonomyVocabularyIndexable(target, taxo, voc));
                if (voc.hasTerms())
                    voc.getTerms().forEach(term -> indexer.index(Indexer.TAXONOMY_INDEX,
                            new TaxonomyTermIndexable(target, taxo, voc, term)));
            });/*from  w w  w  .  j  a  v  a  2s.com*/
    });
}

From source file:com.netflix.spinnaker.orca.mine.pipeline.CanaryPipelineClusterExtractor.java

@Override
public List<Map> extractClusters(Map stage) {
    List<Map> results = new ArrayList<>();
    List<Map> clusterPairs = (List<Map>) stage.getOrDefault("clusterPairs", new ArrayList<>());
    clusterPairs.forEach(pair -> {
        results.add((Map) pair.get("baseline"));
        results.add((Map) pair.get("canary"));
    });//from  www  . j  ava2s .  c  o m
    return results;
}