Implement a static generic method PairUtil.swap whose parameter is a Pair object, using the generic class declared in Section 17.2. The method should return a new pair, with the first and second element swapped.

Complete the following file:

PairUtil.java

Use the following files:

Pair.java

public class Pair<T, S>
{
   private T first;
   private S second;

   public Pair(T firstElement, S secondElement)
   {
      first = firstElement;
      second = secondElement;
   }

   public T getFirst()
   {
      return first;
   }
   
   public S getSecond()
   {
      return second;
   }
}

PairTester.java

public class PairTester
{
   public static void main(String[] args)
   {
      Pair<String, Integer> p = new Pair<String, Integer>("Lucky Number", 13);
      Pair<Integer, String> q = PairUtil.swap(p);
      System.out.println(q.getFirst());
      System.out.println("Expected: 13");
      System.out.println(q.getSecond());
      System.out.println("Expected: Lucky Number");     
   }
}