修改处理逻辑,去掉处理机IP与数据中心作为key的判定条件。

This commit is contained in:
wanglihui
2021-08-16 18:24:13 +08:00
parent e0de04886b
commit e89e1b08c9
13 changed files with 180 additions and 175 deletions

View File

@@ -0,0 +1,23 @@
package com.zdjizhi.utils;
import java.util.Collection;
import java.util.HashSet;
/**
* @author wlh
* 扩展集合处理工具
*/
public class CollectionUtils {
public static<T> Collection<T> takeUniqueLimit(Collection<T> collection, int limit){
int i =0;
Collection<T> newSet = new HashSet<>();
for (T t:collection){
if (i < limit){
newSet.add(t);
i += 1;
}
}
return newSet;
}
}