1
2
3
4
5
6
Use the "Verify Solution" button to get AI feedback on your Java code.
You are tasked with implementing a FixedSizeBlockingQueue class in Java. This queue should have a fixed maximum capacity and must be thread-safe.
The FixedSizeBlockingQueue must support the following operations:
enqueue(E element): Adds an element to the queue. If the queue is full, this method should block until space becomes available.dequeue(): Removes and returns an element from the head of the queue. If the queue is empty, this method should block until an element becomes available.Your implementation must ensure proper synchronization to prevent race conditions and handle blocking/unblocking mechanisms correctly.