我有以下课程:
MinMaxArray 类:
public class MinMaxArray
{
public static <T> void MinMax(T[] anArray)
{
//return an instance of class Pair
}//MinMax
}//class MinMaxArray
对类:
//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
我不确定如何返回 Pair 类的实例。不寻找答案,只是一个起点。谢谢