queue implementation using generic types