如何从Groovy中的组阵列中获取最小值和最大值
我是Groovy的新手,我不知道从哪里开始这个问题。 我有一个XML文件,其中包含带有RID,ID和日期的多个条目。 我设法将元素放入一个数组中,我想提取每个RID分组的RID,最小日期和最大日期。如果小组中只有一个条目,最小日期和最大日期将相同。
Data:
1,1234,2022010101;
2,1235,2022020202;
2,1236,2022030303;
Preferred output:
1,2022010101,2022010101;
2,2022020202,2022030303;
I'm fairly new to Groovy and I don't know where to begin with this problem.
I have a xml file that contains multiple entries with rid, id and a date.
I've managed to get the elements into an array and I would like to extract rid, min date and max date grouped by each rid. If there is only one entry in the group, min and max date would be the same.
Data:
1,1234,2022010101;
2,1235,2022020202;
2,1236,2022030303;
Preferred output:
1,2022010101,2022010101;
2,2022020202,2022030303;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这样的事情:
Try something like this: