Java Utililty Methods List Max

List of utility methods to do List Max

Description

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

Method

doublefindMax(List nums)
find Max
double m = Double.MIN_VALUE;
for (Double x : nums) {
    if (m < x)
        m = x;
return m;
doublefindMax(List values)
find Max
double max = Double.MIN_VALUE;
for (Double d : values) {
    if (d > max)
        max = d;
return max;
intfindMaxDeformationCount(final List counts)
find Max Deformation Count
double max = 0;
for (int[] iA : counts) {
    max = Math.max(max, iA[iA.length - 1]);
return (int) max;
MapfindMaximalMatch(List> mapList, LinkedHashMap fieldsByPriority)
For a list of Map find the entry that best matches the fieldsByPriority Ordered Map; null field values in a Map in mapList match against any value but do not contribute to maximal match score, otherwise value for each field in fieldsByPriority must match for it to be a candidate.
int numFields = fieldsByPriority.size();
String[] fieldNames = new String[numFields];
Object[] fieldValues = new Object[numFields];
int index = 0;
for (Map.Entry<String, Object> entry : fieldsByPriority.entrySet()) {
    fieldNames[index] = entry.getKey();
    fieldValues[index] = entry.getValue();
    index++;
...
longgetMax(List numList)
get Max
long max = Long.MIN_VALUE;
if (numList != null) {
    for (Iterator i = numList.iterator(); i.hasNext();) {
        max = Math.max(((Long) i.next()).longValue(), max);
} else {
    max = -1;
return max;
DoublegetMax(List aList)
get Max
Iterator<Double> itr = aList.iterator();
if (aList.size() > 0) {
    Double max = aList.get(0);
    while (itr.hasNext()) {
        Double d = itr.next();
        if (d > max) {
            max = d;
    return max;
return null;
doublegetMax(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;
doublegetMax(List list)
get Max
double max = -Double.MAX_VALUE;
for (double d : list) {
    if (d > max)
        max = d;
return max;
doublegetMax(List numbers)
Finds the maximum from a list of Doubles.

If the list is empty, 0 is returned.

if (numbers.size() == 0) {
    return 0.0;
double max = numbers.get(0);
for (Double number : numbers) {
    max = Math.max(max, number);
return max;
...
IntegergetMax(List list)
get Max
if (list == null) {
    throw new IllegalArgumentException("Empty list not allowed");
Integer max = Integer.MAX_VALUE;
for (Integer number : list) {
    max = Math.max(number, max);
return max;
...