int[] array = new int[] {3,4,1,2};
List<Integer> list = Arrays.stream(array).boxed().collect(Collectors.toList());
int minIndex = IntStream.range(0,list.size()).boxed()
.min(Comparator.comparingInt(list::get))
.get(); // or throw if empty list
System.out.println(minIndex);
int maxIndex = IntStream.range(0,list.size()).boxed()
.max(Comparator.comparingInt(list::get))
.get(); // or throw if empty list
System.out.println(maxIndex);
public final Stream<Integer> boxed() {
return mapToObj(Integer::valueOf, 0);
} //in stream의 boxed()소스
[ int자체로는 Collection에 못 담기 때문에 Integer 클래스로 변환하여 List<Integer>로 담기 위해 ]