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

doublemax(List l)
max
double max = 0.0;
for (Double d : l)
    if (d > max)
        max = d;
return max;
doublemax(List liste)
max
if (liste.isEmpty()) {
    return 0.0;
double max = -Double.MAX_VALUE;
for (Double val : liste) {
    max = Math.max(max, val.doubleValue());
return max;
...
Listmax(List list, int maximumSize)
Returns a sublist of the given List with the maximum given size.
final List<E> retlist = new ArrayList<E>();
if (list != null && maximumSize >= 0) {
    retlist.addAll(list.subList(0, Math.min(list.size(), maximumSize)));
return retlist;
Stringmax(List runtimeList)
max
long max = Long.MIN_VALUE;
for (long value : runtimeList) {
    max = Math.max(max, value);
return String.valueOf(max);
Numbermax(List numberList)
max
Number answer = null;
double answerValue = Double.MIN_VALUE;
for (Number number : numberList) {
    if (number.doubleValue() > answerValue) {
        answerValue = number.doubleValue();
        answer = number;
return answer;
Tmax(List numbers)
max
T highest = numbers.get(0);
for (T n : numbers) {
    if (n.doubleValue() > highest.doubleValue()) {
        highest = n;
return highest;
Tmax(List objectList)
max
assert !objectList.isEmpty();
if (objectList.isEmpty()) {
    throw new IllegalArgumentException("Number List was empty.");
T max = objectList.get(0);
for (int i = 1; i < objectList.size(); i++) {
    if (objectList.get(i).doubleValue() > max.doubleValue()) {
        max = objectList.get(i);
...
Vmax(List arg)
max
if (arg == null) {
    return null;
if (arg.size() == 1) {
    return arg.get(0);
V max = arg.get(0);
for (V each : arg) {
...
doublemaxAbsVal(List vals)
Get the maximum absolute value
int num = vals.size();
double maxVal = Double.NEGATIVE_INFINITY;
for (int i = 0; i < num; i++) {
    Double val0bj = (Double) vals.get(i);
    if (val0bj.isNaN()) {
        return (val0bj.doubleValue());
    double val = Math.abs(val0bj.doubleValue());
...
intmaxIndex(List list)
max Index
T max = null;
;
int i = 0;
int maxindex = -1;
for (T t : list) {
    if (max == null || t.compareTo(max) > 0) {
        max = t;
        maxindex = i;
...