package com;

import java.util.*;
import java.util.stream.Collectors;

public class LambadaTest {

public static void main(String[] args) {
/* Map<String,List<Map>> map = new HashMap<>();
// List<Map<String,String >> strings = new ArrayList<>();

for (int i = 0; i < 6; i++) {
if (i<4) {
List<Map> list = map.get("1");
if (list==null) {
list = new ArrayList<>();
}
HashMap<String ,String> map1 = new HashMap<>();
map1.put("busicodes",i+"");
list.add(map1);
map.put("1",list);
}else {
List<Map> list = map.get("2");
if (list==null) {
list = new ArrayList<>();
}
HashMap<String ,String> map1 = new HashMap<>();
map1.put("busicodes",i+"");
list.add(map1);
map.put("2",list);
}
}

System.out.println(map);*/

b();

}

public static void a(){

/*Map<String,List<Map>> map = new HashMap<>();

List<Map> maps = map.get(taskType);
if (maps==null) {
maps = new ArrayList<>();
}
HashMap<Object, Object> map1 = new HashMap<>();
map1.put("busiCodes",relienceValue);
maps.add(map1);

Set<Map.Entry<String, List<Map>>> entries = map.entrySet();
for (Map.Entry<String, List<Map>> entry : entries) {
String key = entry.getKey();
object.setTaskType(key);
object.setBusiCodes(entry.getValue());
noticeBpbc();
}*/
}

public static void b(){
Map<String,List<Map>> map = new HashMap<>();

List<Stu> stus = Arrays.asList(new Stu("0", "02"), new Stu("0", "04"), new Stu("1", "07"));
for (Stu stu : stus) {
List<Map> maps = map.get(stu.taskType);
if (maps==null) {
maps = new ArrayList<>();
}
map.put(stu.taskType,maps);

HashMap<Object, Object> busiCodesMap = new HashMap<>();
busiCodesMap.put("busiCodes",stu.relienceValue);
maps.add(busiCodesMap);
}

System.out.println("map:"+map);

A obj = new A();
Set<Map.Entry<String, List<Map>>> entries = map.entrySet();
for (Map.Entry<String, List<Map>> entry : entries) {
String key = entry.getKey();
obj.setTaskType(key);
obj.setBusiCodes(entry.getValue());
System.out.println("obj:"+obj);
}

}
}

map转listmap的更多相关文章

  1. fastjson解析list ,object中含有list, object中含有map

    1.首先定义测试vo package com.haiyisoft.cAssistantWeb.ui; import java.sql.Timestamp; public class vo {priva ...

  2. streamsets Processors 说明

    Processors 表示对于一种数据操作处理,在pipeline中可以应用多个Processors, 同时根据不同的执行模式,可以分为独立模式的,集群模式.边缘模式(agent),以及 帮助测试的测 ...

  3. 【小家Spring】聊聊Spring中的数据绑定 --- BeanWrapper以及内省Introspector和PropertyDescriptor

    #### 每篇一句 > 千古以来要饭的没有要早饭的,知道为什么吗? #### 相关阅读 [[小家Spring]聊聊Spring中的数据转换:Converter.ConversionService ...

  4. 详叙BeanWrapper和PropertyDescriptor

    每篇一句 千古以来要饭的没有要早饭的,知道为什么吗? 相关阅读 [小家Spring]聊聊Spring中的数据转换:Converter.ConversionService.TypeConverter.P ...

  5. 使用java读取解析txt文本数据,管理简单的数据

    在实际开发中会经常碰到使用编程语言读取文本文件的内容,这内容可以是各种各样的一下本人写出我自己做的一个读取文本文件的例子,文件中存储的是我的个人网站 www.yzcopen.com 导航栏目因为懒得使 ...

  6. 自己挖的坑自己填--jxl进行Excel下载堆内存溢出问题

    今天在进行使用 jxl 进行 Excel 下载时,由于数据量大(4万多条接近5万条数据的下载),数据结构过于负责,存在大量大对象(虽然在对象每次用完都设置为null,但还是存在内存溢出问题),加上本地 ...

  7. 遍历listmap 遍历map

    package excel; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import j ...

  8. 将两个ListMap中同下标的map去重合并

    public static void main(String[] args) { Map<String,Object> oneMap = new HashMap<>(); on ...

  9. 递归将Map里的字段名由驼峰转为下划线

    导航 定位 概述 算法设计 递归技巧 代码实现 定位 本文适合于想要使用Java递归地将Map里的Key字段名从驼峰转为下划线,或者想了解如何处理任意递归的Map结构的筒鞋. 概述 在进行多语言混合编 ...

  10. alibaba fastjson List<Map<String, String>>2Str

    import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map; impo ...

随机推荐

  1. linux上安装python3(yum方式)

    可联通外网的linux系统终端上安装python3 1,建立yum仓库: https://mirrors.163.com/centos/7.9.2009/os/x86_64/ 2,使用yum下载安装对 ...

  2. REDIS基础要点

    简述:redis 单实例,单进程,当线程处理用户请求数据,基于内存对数据处理.Redis默认分为0-16号库,每个库互相隔离(数据不共享) 基础复习: 1,系统中的每个进程对应有一个fd,通过网卡连接 ...

  3. JMeter 常用的几种断言方法

    一.Jmeter 断言背景 在使用Jmeter进行性能测试或者接口自动化测试工作中,经常会用到的一个功能,就是断言.断言是在请求的返回层面增加一层判断机制.因为请求成功了,并不代表结果一定正确,因此需 ...

  4. ubutu22.04开启ssh配置

    1.查看ubuntu版本信息 lsb_release -a 2.更新系统 sudo apt update && sudo apt upgrade -y 如果出现Ign:1 ...InR ...

  5. conda迁移虚拟环境

    Conda离线迁移虚拟环境主要是两步: 1 在原环境中打包 2 将打好的包copy到目标环境的指定位置 打包的命令很简单 conda pack -n 虚拟环境名 当试图导出base时,报错了 Cond ...

  6. Linux编辑器

    Vim 安装: yum install vim $ vim test.cnf  --打开文件 命令模式: i  --切换到输入模式,以输入字符 :  --切换到底线命令模式,以在最底一行输入命令 输入 ...

  7. Lucky Chains(最大公约数的应用)

    题目:Lucky Chains 题意: 给定两个正整数a, b,若(a, b) = (a + 1, b + 1) = (a + 2, b + 2) = ... = (a + k, b + k) = 1 ...

  8. sql server 最近执行语句统计查询分析

    查询语句: select * from ( SELECT [RowNumber],DATEDIFF(second, StartTime, isnull(EndTime ,StartTime)) 执行时 ...

  9. Vuforial 使用小计

    1. 在使用扫图功能的时候, 上传图片审核处,要根据图片真实的宽度尺寸设置宽度. 2.做物体识别时,识别的物体最好是一个长方体或正方体,这样识别度高一些. 3.如果是其它物体识别要保证物体大一些,身体 ...

  10. Linux 搭建Apache(httpd)服务

    简介:Apache HTTP Server是开源软件项目,基于标准的HTTP网络协议提供的网页浏览服务,http是Apache服务器的主程序,它是一个独立的后台进程. 1. 安装 A. 安装httpd ...