Java Utililty Methods Collection Min

List of utility methods to do Collection Min

Description

The list of methods to do Collection Min are organized into topic(s).

Method

Tmin(Collection values)
min
T min = null;
Iterator<T> it = values.iterator();
if (it.hasNext()) {
    min = it.next();
    while (it.hasNext()) {
        T n = it.next();
        if (n.compareTo(min) < 0) {
            min = n;
...
Tmin(final Collection collection)
min
if (collection == null || collection.size() <= 0) {
    return null;
T max = null;
for (final T elem : collection) {
    if (max == null || elem.compareTo(max) < 0) {
        max = elem;
return max;
IntegerminI(Collection col)
min I
if (col.isEmpty()) {
    return null;
int min = Integer.MAX_VALUE;
for (Integer integer : col) {
    if (integer < min) {
        min = integer;
return min;
intminInt(Collection ints)
find the min integer
int ret = Integer.MAX_VALUE;
for (int i : ints)
    if (i < ret)
        ret = i;
return ret;
intminKmerLength(final Collection kmers)
Get the minimum length of a collection of byte[]
if (kmers == null)
    throw new IllegalArgumentException("kmers cannot be null");
if (kmers.isEmpty())
    return 0;
int min = Integer.MAX_VALUE;
for (final byte[] kmer : kmers) {
    min = Math.min(min, kmer.length);
return min;
TminOr(Collection values, T defaultVal)
Like Collections#min(java.util.Collection) except with a default value returned in the case of an empty collection.
if (values.isEmpty()) {
    return defaultVal;
} else {
    return Collections.min(values);