Насколько я вижу - метода именно что два.
Не понимаю что я не так сделала
package com.javarush.task.task12.task1233;
import java.util.*;
import java.util.stream.IntStream;
/*
Изоморфы наступают
*/
public class Solution {
public static void main(String[] args) throws Exception {
int[] data = new int[]{1, 2, 3, 5, -2, -8, 0, 77, 5, 5};
Pair<Integer, Integer> result = getMinimumAndIndex(data);
System.out.println("The minimum is " + result.x);
System.out.println("The index of the minimum element is " + result.y);
}
public static Pair<Integer, Integer> getMinimumAndIndex(int[] array) {
if (array == null || array.length == 0) {
return new Pair<Integer, Integer>(null, null);
}
else{
int x=Arrays.stream(array).min().getAsInt();
return new Pair <Integer, Integer>(x,
IntStream.range(0, array.length-1).filter(min-> array[min] == x).findFirst().getAsInt());
}
//напишите тут ваш код x - значение,y - индекс
// return new Pair<Integer, Integer>(0, 0);
}
public static class Pair<X, Y> {
public X x;
public Y y;
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
}
}
IntStream.range(0, array.length-1)