I need to write a generic class Pair which has two type parameters F and S (first and second) each representing the first and second elements of the pair. Add get and set elements so that the values of the pair can be changed.
This is an example of the code of the test class that calls for the pair class.
public class PairTest
{
public static void main( String args[] )
{
// create pair of integer and string
Pair< Integer, String > numberPair =
new Pair< Integer, String >( 1, "one" );
// display original numberPair
System.out.printf( "Original pair: < %d, %s >n",
numberPair.getFirst(), numberPair.getSecond() );
// modify pair
numberPair.setFirst( 2 );
numberPair.setSecond( "Second" );
// display modified numberPair
System.out.printf( "Modified pair: < %d, %s >n",
numberPair.getFirst(), numberPair.getSecond() );
} // end method main
} // end class PairTest