I have the following classes:
MinMaxArray class:
public class MinMaxArray
{
public static <T> void MinMax(T[] anArray)
{
//return an instance of class Pair
}//MinMax
}//class MinMaxArray
Pair class:
//Two objects grouped into a pair.
public class Pair<FirstType, SecondType>
{
//The first object.
private final FirstType first;
//The second object.
private final SecondType second;
//Constructor is given the two objects.
public Pair(FirstType requiredFirst, SecondType requiredSecond)
{
first = requiredFirst;
second = requiredSecond;
}//Pair
//Return the first object.
public FirstType getFirst()
{
return first;
}//GetFirst
//Return the second object.
public SecondType getSecond()
{
return second;
}//GetSecond
}//class Pair
I’m not sure how i can go about returning an instance of the Pair class. Not looking for answers, just a starting point. Thanks
A hint is you can create a Pair, with
Tas the two types.