Java List Max maxIndex( List list)

Here you can find the source of maxIndex( List list)

Description

max Index

License

Open Source License

Declaration

public static <T extends Comparable<? super T>> int maxIndex(
            List<T> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    public static <T extends Comparable<? super T>> int maxIndex(
            List<T> list) {
        T max = null;//from  ww  w. ja  v  a  2 s  . c om
        ;
        int i = 0;
        int maxindex = -1;
        for (T t : list) {
            if (max == null || t.compareTo(max) > 0) {
                max = t;
                maxindex = i;
            }
            i++;
        }
        return maxindex;
    }
}

Related

  1. max(List numberList)
  2. max(List numbers)
  3. max(List objectList)
  4. max(List arg)
  5. maxAbsVal(List vals)
  6. maxIndex(List list)
  7. maxInnerSize(List> listOfLists)
  8. maxInt(List array)
  9. maxLength(List patterns)