Java Collection Min min(Collection a)

Here you can find the source of min(Collection a)

Description

Find the smallest integer in a collection.

License

Open Source License

Parameter

Parameter Description
a the collection of integers

Return

the smallest integer in a.

Declaration

public static int min(Collection<Integer> a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    /**//w  w  w.  ja  va 2 s  .c om
     * Find the smallest integer in a collection.
     * 
     * @param a
     *            the collection of integers
     * @return the smallest integer in a.
     */
    public static int min(Collection<Integer> a) {
        int i = Integer.MAX_VALUE;
        for (int z : a)
            i = Math.min(z, i);
        return i;
    }

    public static int min(Collection<Collection<Integer>> d, Object e) {
        int i = Integer.MAX_VALUE;
        for (Collection<Integer> g : d)
            i = Math.min(i, min(g));
        return i;
    }
}

Related

  1. min(Collection coll)
  2. min(Collection data)
  3. min(Collection doubles)
  4. min(Collection values)
  5. min(Collection list)
  6. min(Collection strs)
  7. min(Collection col)
  8. min(Collection elems)