已解决
java集合常用方法汇总
来自网友在路上 163863提问 提问时间:2023-10-10 15:56:25阅读次数: 63
最佳答案 问答题库638位专家为你答疑解惑
集合排序链接
集合排序链接
1.新建集合
List<String> result = Lists.newArrayList();
2.集合赋值
List<String> orderStatusList = Lists.newArrayList("60", "70", "90");
3.遍历集合
list.stream().map(CspTransferOrderInfo::getTransferOutOrderCode).filter(StringUtils::isNotBlank).collect(Collectors.toList());
4.集合逗号分割为字符串
StringUtils.join(transferOutOrderCodeList, "、")
String.join(",", cspShop.getWarehouseCodeList()
String equipmentNumberList = list.stream().map(CspWarehouseEquipment::getEquipmentNumber).collect(Collectors.joining(","));
5.Stirng 转 List
CommonUtils.stringChangeList(cspCustomerOrderInfo.getOutOrderCode())
6.集合分组
Map<String, List> listMap = customerInfoList
.stream()
.collect(Collectors.groupingBy(CscCustomerInfo::getPostCode));
7.集合分组+转map集合
List<InterfaceMappingConfigurationDetails> mappingDetailsList = iInterfaceMappingConfigurationDetailsService.selectInterfaceMappingConfigurationDetailsList(selectInterfaceMappingDetails);Map<String, Map<String, String>> groupByMappingType = mappingDetailsList.stream().collect(Collectors.groupingBy(InterfaceMappingConfigurationDetails::getMappingType,Collectors.toMap(InterfaceMappingConfigurationDetails::getOmsCode,InterfaceMappingConfigurationDetails::getErpCode,(v1,v2)->v1)));
8.List转List
/*** 集合类型转换** @param longList 参数* @return 结果*/private static List<String> convertToStringList(List<Long> longList) {List<String> stringList = new ArrayList<>();for (Long num : longList) {stringList.add(num.toString());}return stringList;}
9.List转List
String destinationCode = '12,1233,4444,32222,';
List<Long> indexIds = Arrays.stream(destinationCode.split(",")).map(Long::parseLong).collect(Collectors.toList());
查看全文
99%的人还看了
相似问题
- 使用WalletConnect Web3Modal v3 链接钱包基础教程
- MongoDB——golang操作(链接,CURD,聚合)
- HTML 超链接 a 标签
- WSL2安装ubuntu及修改安装位置,设置Ubuntu开机启动链接ssh服务
- Zotero在word中插入带超链接的参考文献/交叉引用/跳转参考文献
- 【Mysql】复合查询详解+实战操作(多表查询、自链接、子查询等)
- 如何将vscode和Linux远程链接:
- 轻松搭建短域名短链接服务系统,可选权限认证,并自动生成证书认证把nginx的http访问转换为https加密访问,完整步骤和代码
- 批量替换WordPress文章内图片链接
- 什么是BT种子!磁力链接又是如何工作的?
猜你感兴趣
版权申明
本文"java集合常用方法汇总":http://eshow365.cn/6-18456-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!