Generics, add using generics and swap array element using generics