All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
import java.util.*;
class Request { }
class RequestCollector{
//1 : Insert declaration here
public synchronized void addRequest(Request r){
container.add(r);
}
public synchronized Request getRequestToProcess(){
return container.poll();
}
}
What can be inserted at //1?
In the explanation there is
(...)the use of poll() method indicates that it must be a Queue. Both LinkedList and PriorityQueue classes implement Queue interface.
In case of Queue container = new PriorityQueue(); the container is not typed to Queue<Request>. So container.poll() will not satisfy the return type of the method.