zoukankan      html  css  js  c++  java
  • Collectors.groupingBy应用

    @Override
    public Map<String, Map<String, List<ServiceGitEntity>>> uiCasePolicyDropList(long jiraBrand) {
    Example example = new Example(ServiceEntity.class);
    Example.Criteria criteria = example.createCriteria();
    criteria.andEqualTo("jiraBrand", jiraBrand);
    List<ServiceEntity> serviceEntities = serviceMapper.selectByExample(example);
    List<GitEntity> gitEntities = gitMapper.getByType(GitType.UT.getCode());
    List<ServiceGitEntity> serviceGitEntities = new ArrayList<>();
    ServiceGitEntity serviceGit = null;
    for (ServiceEntity serviceEntity : serviceEntities) {
    for (GitEntity gitEntity : gitEntities) {
    if (serviceEntity.getId().equals(gitEntity.getServiceId())) {
    serviceGit = new ServiceGitEntity();
    serviceGit.setProject(serviceEntity.getProject());
    serviceGit.setBranch(gitEntity.getBranch());
    serviceGit.setName(serviceEntity.getName());
    serviceGit.setId(serviceEntity.getId());
    serviceGit.setUrl(gitEntity.getUrl());
    if (!serviceGitEntities.contains(serviceGit)) {
    serviceGitEntities.add(serviceGit);
    }
    }
    }
    }
    Map<String, Map<String, List<ServiceGitEntity>>> map = serviceGitEntities.stream().collect(Collectors.groupingBy(ServiceGitEntity::getProject,Collectors.groupingBy(ServiceGitEntity::getName)));
    return map;
    }
  • 相关阅读:
    用List绑定GridView的简单辅助类
    宋忠玲(帮读者名字作诗)
    [转帖]每天看一遍,释怀所有难过
    30岁,我们怎么赢?
    柴门远望
    创业,不要被那些成功人士所忽悠
    一只海燕飞过来
    成功者都在用的“成功咒语”
    诗歌复兴
    游熊猫基地有感
  • 原文地址:https://www.cnblogs.com/cristin/p/14277698.html
Copyright © 2011-2022 走看看