Question: Why not have a single Co17ection data type that implements methods to add items, remove the most recently inserted item, remove the least recently inserted

Why not have a single Co17ection data type that implements methods to add items, remove the most recently inserted item, remove the least recently inserted item, remove a random item, iterate over the items, return the number of items in the collection, and whatever other operations we might desire? Then we could get them all implemented in a single class that could be used by many clients.

Step by Step Solution

3.38 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Great question In theory having a single universal Collection data type that implements a wide varie... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithm Design Questions!