//=================================================================================================
public class GenericPair<T> {
//-------------------------------------------------------------------------------------------------
    private T firstOfPair,secondOfPair;
//-------------------------------------------------------------------------------------------------
    public GenericPair() {

        firstOfPair = null;
        secondOfPair = null;
    }
//-------------------------------------------------------------------------------------------------
    public GenericPair(T initialFirstOfPair,T initialSecondOfPair) {

        this();
        firstOfPair = initialFirstOfPair;
        secondOfPair = initialSecondOfPair;
    }
//-------------------------------------------------------------------------------------------------
    public boolean setElement(int index,T value) {

        switch (index) {
            case 1:
                firstOfPair = value;
                return(true);
            case 2:
                secondOfPair = value;
                return(true);
            default:
                return(false);
        }
    }
//-------------------------------------------------------------------------------------------------
    public T getElement(int index) {

        switch (index) {
            case 1:
                return(firstOfPair);
            case 2:
                return(secondOfPair);
            default:
                return(null);
        }
    }
//-------------------------------------------------------------------------------------------------
    public String toString() {

        return("+++ " + firstOfPair + " +++ " + secondOfPair + " +++");
    }
//-------------------------------------------------------------------------------------------------
}
//=================================================================================================

