java 中使用 tuple

java 中默认没有 tupple, 写惯了其它语言,很不习惯

引入以下jar包

<dependency>
            <groupId>com.othelle.jtuples</groupId>
            <artifactId>jtuples</artifactId>
            <version>0.1.3</version>
        </dependency>

代码如下:

复制代码
import com.othelle.jtuples.Tuple2;
import com.othelle.jtuples.Tuples;

List<Tuple2<String,String>> items = new ArrayList<>();
items.add(Tuples.tuple("a","1"));
items.add(Tuples.tuple("b","2"));

//还有下面这段
var gradeGroupUsers = dutyPlanGradesService.list(new LambdaQueryWrapper<DutyPlanGrades>()
                .eq(DutyPlanGrades::getOrgUuid, orgUuid)
                .eq(DutyPlanGrades::getTermUuid, termUuid))
                .stream().map(x -> Tuples.tuple(x.getDutyGroupId(), x.getUserUuid()))
                .collect(Collectors.toList());
复制代码

 

posted on   空明流光  阅读(3049)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
历史上的今天:
2021-04-28 SQL Server 执行 cmd 命令
2021-04-28 C# UTF-8 with BOM 编码

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示