In order to obtain the interfaces that are directly implemented by a class or interface represented by an object, we simply call Class.getInterfaces(). This method returns an array. Since the Pair class implements a single interface (Comparable), the returned array will contain a single element:
Class<?>[] interfaces = clazz.getInterfaces();
// interface java.lang.Comparable
System.out.println("Interfaces: " + Arrays.toString(interfaces));
// Comparable
System.out.println("Interface simple name: "
+ interfaces[0].getSimpleName());