查找连续ArrayList条目的最小条目的索引
//package com.nowjava; import java.util.ArrayList; /* *来 自 N o w J a v a . c o m - 时 代 Java */ public class Main { /** * finds the index of the smallest entry in a continuous span of ArrayList entries * @param arrayList the ArrayList that you want to find entries for * @param first the starting index of the searched entry span * @param last the ending index of the searched entry span * @return the index of the smallest entry found between $first and $last */ public static <T extends Comparable<? super T>> int getIndexOfSmallest( ArrayList<T> arrayList, int first, int last) { if (arrayList.size() > 0) { int smallestIndex = first; T smallestEntry = arrayList.get(first); for (int i = first; i <= last; i++) { if (arrayList.get(i).compareTo(smallestEntry) == -1) {/**来自 N o w J a v a . c o m**/ smalle