gpt4 book ai didi

java - 查找重复超过3次的id

转载 作者:行者123 更新时间:2023-12-01 22:47:11 24 4
gpt4 key购买 nike

我需要找到重复次数超过 3 次的重复迟到者。 LateComers 包含可能重复超过 3 次的客户列表。

 List<Long> repeatedLateComersId=new ArrayList<Long>();
for (Customer repeatedLateComers : lateComers) {
repeatedLateComersId.add(repeatedLateComers.getId());
}

请帮助我。

最佳答案

您可以使用Collections#Frequency来查找集合中出现的次数。

例如:

int i = Collections.frequency(list, "obj"); //This will return String obj's occurrences in list

关于java - 查找重复超过3次的id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25160594/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com