mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add min and max
This commit is contained in:
parent
c6f2754221
commit
a9b08161c3
@ -19,6 +19,7 @@
|
||||
* 【setting】 SettingLoader支持自定义分隔符
|
||||
* 【http】 Content-Type添加默认值(issue#I11YHI@Gitee)
|
||||
* 【socket】 增加Closeable接口(issue#532@Github)
|
||||
* 【core】 CollUtil增加min和max方法
|
||||
|
||||
### Bug修复
|
||||
* 【core】 修复NetUtil.getUsableLocalPort问题(pr#69@Gitee)
|
||||
|
@ -2499,6 +2499,32 @@ public class CollUtil {
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取最大值
|
||||
*
|
||||
* @param <T> 元素类型
|
||||
* @param coll 集合
|
||||
* @return 最大值
|
||||
* @since 4.6.5
|
||||
* @see Collections#max(Collection)
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> T max(Collection<T> coll) {
|
||||
return Collections.max(coll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取最大值
|
||||
*
|
||||
* @param <T> 元素类型
|
||||
* @param coll 集合
|
||||
* @return 最大值
|
||||
* @since 4.6.5
|
||||
* @see Collections#min(Collection)
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> T min(Collection<T> coll) {
|
||||
return Collections.min(coll);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------- Interface start
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
* @param <V>
|
||||
*/
|
||||
public class TableMap<K, V> implements Map<K, V>, Serializable {
|
||||
private static final long serialVersionUID = -5852304468076152385L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<K> keys;
|
||||
private List<V> values;
|
||||
|
Loading…
x
Reference in New Issue
Block a user