Implementation of generic array

swap and comparison methods for generic array