Added generic type as return type since shift() and pop() return an item from the array