Java Utililty Methods List Min

List of utility methods to do List Min

Description

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

Method

doublefindMin(List nums)
find Min
double m = Double.MAX_VALUE;
for (Double x : nums) {
    if (m > x)
        m = x;
return m;
doublefindMin(List values)
find Min
double min = Double.MAX_VALUE;
for (double d : values) {
    if (d < min)
        min = d;
return min;
longgetMin(List numList)
get Min
long min = Long.MAX_VALUE;
if (numList != null) {
    for (Iterator i = numList.iterator(); i.hasNext();) {
        min = Math.min(((Long) i.next()).longValue(), min);
} else {
    min = -1;
return min;
DoublegetMin(List aList)
Finds the lowest positive double in a list.
Double lowest = Double.POSITIVE_INFINITY;
boolean check = false;
for (Iterator<Double> iterator = aList.iterator(); iterator.hasNext();) {
    Double d = iterator.next();
    if (lowest >= d && d > 0) {
        lowest = d;
        check = true;
if (check) {
    return lowest;
} else {
    return -1.0;
doublegetMin(List d)
Returns the maximum value of an Arraylist with doubles
double res = Double.MAX_VALUE;
for (Double db : d) {
    if (db < res)
        res = db;
return res;
doublegetMin(List numbers)
Finds the minimum from a list of Doubles.

If the list is empty, 0 is returned.

if (numbers.size() == 0) {
    return 0.0;
double min = numbers.get(0);
for (Double number : numbers) {
    min = Math.min(min, number);
return min;
...
StringgetMinId(List ids)
get Min Id
String oozieId = ids.get(0);
int minInt = Integer.valueOf(oozieId.split("-")[0]);
for (int i = 1; i < ids.size(); i++) {
    String currentId = ids.get(i);
    int currInt = Integer.valueOf(currentId.split("-")[0]);
    if (currInt < minInt) {
        oozieId = currentId;
return oozieId;
ListgetMinimums(List data)
get Minimums
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
List<Double> yMax = new ArrayList<Double>();
getPeriodBounds(data, data, xMin, yMin, xMax, yMax);
return xMin;
doublegetMinValue(List values)
get Min Value
if (values.isEmpty()) {
    return -1.0;
double min = Double.MAX_VALUE;
for (Double value : values) {
    if (value < min) {
        min = value;
return min;
intgetMinWhitespace(final List lines)
Gets the minimum amount of leading whitespace in a text block.
int minWhitespace = 0;
for (String line : lines) {
    int lineLeadingWhitespace = getLeadingWhitespace(line);
    if (lineLeadingWhitespace < minWhitespace || minWhitespace == 0) {
        minWhitespace = lineLeadingWhitespace;
return minWhitespace;
...