Question: Code please. Java 17.1 Very patient Queues A queue stores the objects it gets fed in some internal mechanism. We do not know what mechanism

Code please. Java
17.1 Very patient Queues A queue stores the objects it gets fed in some internal mechanism. We do not know what mechanism it uses, and in general, we don't care. But sometimes we need more control. One example would be that we need a queue which would discard double objects, in effect using a Set as its internal storage mechanism. Write a class implementing the Queue interface. This class has a constructor with a Collection as a parameter; this Collection would be the internal storage of the Queue. Extend your class to create a BlockingQueue. Make sure to implement the interface BlockingQueue (check the Java API!) 17.2 Sorted Maps We need a specialized form of a Map: - It is a Map - It stays sorted, so it behaves like a SortedSet - Ordering is based on the natural ordering of its Values, not its Keys! - Do not implement the methods entrySet(), keySet() and values() for now - Performance is not an issue here Implement a class doing all this. Then extend your SortedMap to: - Implement the methods keySet(), entrySet() and values(); - The API states that the collections returned by these methods 'are backed by the Map'. That means they immediately reflect any changes made to the Map - You can use the Observer pattern to achieve this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
