Java Collection Min min(Collection values)

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

Description

min

License

Open Source License

Declaration

public static Double min(Collection<Double> values) 

Method Source Code


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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Main {
    public static Double min(Collection<Double> values) {
        List<Double> filteredValues = filterNulls(values);
        if (filteredValues.size() == 0)
            return null;

        return Collections.min(filteredValues);
    }/*from  www  . j  a  v a 2 s .  c om*/

    private static List<Double> filterNulls(Collection<Double> values) {
        List<Double> result = new ArrayList<>();
        for (Double value : values) {
            if (value != null)
                result.add(value);
        }

        return result;
    }
}

Related

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