map转listmap
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的更多相关文章
- fastjson解析list ,object中含有list, object中含有map
1.首先定义测试vo package com.haiyisoft.cAssistantWeb.ui; import java.sql.Timestamp; public class vo {priva ...
- streamsets Processors 说明
Processors 表示对于一种数据操作处理,在pipeline中可以应用多个Processors, 同时根据不同的执行模式,可以分为独立模式的,集群模式.边缘模式(agent),以及 帮助测试的测 ...
- 【小家Spring】聊聊Spring中的数据绑定 --- BeanWrapper以及内省Introspector和PropertyDescriptor
#### 每篇一句 > 千古以来要饭的没有要早饭的,知道为什么吗? #### 相关阅读 [[小家Spring]聊聊Spring中的数据转换:Converter.ConversionService ...
- 详叙BeanWrapper和PropertyDescriptor
每篇一句 千古以来要饭的没有要早饭的,知道为什么吗? 相关阅读 [小家Spring]聊聊Spring中的数据转换:Converter.ConversionService.TypeConverter.P ...
- 使用java读取解析txt文本数据,管理简单的数据
在实际开发中会经常碰到使用编程语言读取文本文件的内容,这内容可以是各种各样的一下本人写出我自己做的一个读取文本文件的例子,文件中存储的是我的个人网站 www.yzcopen.com 导航栏目因为懒得使 ...
- 自己挖的坑自己填--jxl进行Excel下载堆内存溢出问题
今天在进行使用 jxl 进行 Excel 下载时,由于数据量大(4万多条接近5万条数据的下载),数据结构过于负责,存在大量大对象(虽然在对象每次用完都设置为null,但还是存在内存溢出问题),加上本地 ...
- 遍历listmap 遍历map
package excel; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import j ...
- 将两个ListMap中同下标的map去重合并
public static void main(String[] args) { Map<String,Object> oneMap = new HashMap<>(); on ...
- 递归将Map里的字段名由驼峰转为下划线
导航 定位 概述 算法设计 递归技巧 代码实现 定位 本文适合于想要使用Java递归地将Map里的Key字段名从驼峰转为下划线,或者想了解如何处理任意递归的Map结构的筒鞋. 概述 在进行多语言混合编 ...
- alibaba fastjson List<Map<String, String>>2Str
import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map; impo ...
随机推荐
- Tensorflow 1.X 在windows上的安装
参考:https://blog.csdn.net/weixin_42326479/article/details/105539110 pip install -i https://pypi.douba ...
- oculus 安装其他盘方法
把安装文件OculusSetup.exe安装到D盘(默认直接按C盘) D:\softbackup\OculusSetup.exe /drive=D
- 金蝶AAS-V9精简版使用手册1.6
1.安装 获取中间件安装包(AAAS.V9.ZIP)直接解压即可. 1.1.需安装jdk环境,上篇文章 1.2.路径没有特定要求,通常放置在/opt下 2.初次启动金蝶需要前台启动设置管控密码 lin ...
- iOS开发 性能优化
1.快 2.稳 3.省 4.小
- CodeGym自学笔记05——类名
1.Java 程序由类组成.每个类都存储在一个单独的文件中,其文件名称与类名一致.该文件的扩展名为 java. 2.当我们有许多类文件时,我们会将它们分组到文件夹和子文件夹中.此外,类还会被分组到包和 ...
- dp-状压dp
https://www.bilibili.com/video/BV1Z4411x7Kw?from=search&seid=13855865082722302053 状压介绍: 状态表示: 转移 ...
- 【个人笔记】CentOS 安装 Docker CE
要在 CentOS 上开始使用 Docker CE,请确保 满足先决条件,然后 安装Docker. 1. 卸载旧版本 sudo yum remove docker docker-client dock ...
- 《CSOL大灾变》Mobile移植记录——购买区域
在CSOL大灾变模式中,购买武器只能出现在特定区域,如下: 这里可以通过添加一些不渲染的BOX(如图中的蓝色BOX)作为触发器,然后检测玩家与之触发后才能弹出购买菜单. 在JmonkeyEngi ...
- MobaXterm汉化版教程
MobaXterm中文版是一款非常好用的远程连接.远程控制软件,它堪称全能终端神器,支持非常多的远程协议 ,如SSH,Telnet,Rsh,Xdmc,RDP,VNC,FTP,SFTP,串口(Seria ...
- unity 阿拉伯数字转中文汉字
直接调用即可 代码如下: using System; using System.Collections; using System.Collections.Generic; using System. ...