Stacks and Queues Implementation in java