Here you can find the source of maxIndex( List
public static <T extends Comparable<? super T>> int maxIndex( List<T> list)
//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; } }