public class CollectionKits extends Object
| 构造器和说明 |
|---|
CollectionKits() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends Comparable<?>> |
bottomN(Iterable<T> coll,
int n)
返回Iterable中最小的N个对象.
|
static <T> List<T> |
bottomN(Iterable<T> coll,
int n,
Comparator<? super T> comp)
返回Iterable中最小的N个对象.
|
static <T> T |
getFirst(Collection<T> collection)
取得Collection的第一个元素,如果collection为空返回null.
|
static <T> T |
getLast(Collection<T> collection)
获取Collection的最后一个元素,如果collection为空返回null.
|
static <T extends Object & Comparable<? super T>> |
minAndMax(Collection<? extends T> coll)
同时返回无序集合中的最小值和最大值,使用元素默认排序
在返回的Pair中,第一个为最小值,第二个为最大值
copy from vjtools
|
static <T> Pair<T,T> |
minAndMax(Collection<? extends T> coll,
Comparator<? super T> comp)
返回无序集合中的最小值和最大值
在返回的Pair中,第一个为最小值,第二个为最大值
copy from vjtools
|
static <T extends Comparable<?>> |
topN(Iterable<T> coll,
int n)
返回Iterable中最大的N个对象.
|
static <T> List<T> |
topN(Iterable<T> coll,
int n,
Comparator<? super T> comp)
返回Iterable中最大的N个对象.
|
public static <T> T getFirst(Collection<T> collection)
copy from vjtools
T - collection - public static <T> T getLast(Collection<T> collection)
copy from vjtools
T - collection - public static <T extends Object & Comparable<? super T>> Pair<T,T> minAndMax(Collection<? extends T> coll)
在返回的Pair中,第一个为最小值,第二个为最大值
copy from vjtools
T - coll - public static <T> Pair<T,T> minAndMax(Collection<? extends T> coll, Comparator<? super T> comp)
在返回的Pair中,第一个为最小值,第二个为最大值
copy from vjtools
T - coll - comp - public static <T extends Comparable<?>> List<T> topN(Iterable<T> coll, int n)
copy from vjtools
T - coll - n - public static <T> List<T> topN(Iterable<T> coll, int n, Comparator<? super T> comp)
copy from vjtools
T - coll - n - comp - public static <T extends Comparable<?>> List<T> bottomN(Iterable<T> coll, int n)
copy from vjtools
T - coll - n - public static <T> List<T> bottomN(Iterable<T> coll, int n, Comparator<? super T> comp)
copy from vjtools
T - coll - n - comp - Copyright © 2020. All rights reserved.