我尝试使用以下代码获取数组中最小整数的索引,但indexOf返回-1。
package tutorial;
import java.util.Arrays;
public class Lists {
public static void main(String[] args){
int[] stuff = {4,3,2,1,8,4};
int minValue = Arrays.stream(stuff).min().getAsInt();
System.out.println(minValue);
int smallestIndex = Arrays.asList(stuff).indexOf(minValue);
System.out.println(smallestIndex);
}
}