Java Collection Min minInt(Collection ints)

Here you can find the source of minInt(Collection ints)

Description

find the min integer

License

Open Source License

Parameter

Parameter Description
ints a parameter

Declaration

public static int minInt(Collection<Integer> ints) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 pf_miles./*from   w  w  w .j a  v a 2 s  . co  m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     pf_miles - initial API and implementation
 ******************************************************************************/

import java.util.Collection;

public class Main {
    /**
     * find the min integer
     * 
     * @param ints
     * @return
     */
    public static int minInt(Collection<Integer> ints) {
        int ret = Integer.MAX_VALUE;
        for (int i : ints)
            if (i < ret)
                ret = i;
        return ret;
    }
}

Related

  1. min(Collection elems)
  2. min(Collection values)
  3. min(Collection values)
  4. min(final Collection collection)
  5. minI(Collection col)
  6. minKmerLength(final Collection kmers)
  7. minOr(Collection values, T defaultVal)