Added generic pair class and generic method in arrayalg class