Use generics in heap