### Question:
MapBasedLinkedBlockingQueue implements BlockingQueue<T> { @Override public boolean remove(Object o) { boolean result = false; if (o != null) { Iterator<T> iterator = this.iterator(); while (iterator.hasNext()) { T element = iterator.next(); if (element.equals(o)) { iterator.remove(); return true; } } } return result; } MapBasedLinkedBlockingQueue(ConcurrentMap<Long, T> internalMap); @Override void put(T t); @Override boolean offer(T t, long l, TimeUnit timeUnit); @Override boolean offer(T t); @Override T take(); @Override T poll(long l, TimeUnit timeUnit); @Override int remainingCapacity(); @Override T poll(); @Override T element(); @Override T peek(); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> collection); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<T> iterator(); @Override Object[] toArray(); @Override T1[] toArray(T1[] t1s); @Override void clear(); @Override int drainTo(Collection<? super T> collection); @Override int drainTo(Collection<? super T> collection, int i); @Override boolean add(T t); @Override T remove(); @Override boolean addAll(Collection<? extends T> collection); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection);  }### Answer:
@Test void remove() { BlockingQueue<String> queue = new MapBasedLinkedBlockingQueue(this.map); assertEquals(4, queue.size()); queue.add("Bar"); assertEquals(5, queue.size()); assertTrue(queue.remove("Bar")); assertEquals(4, queue.size()); assertEquals("Baz", queue.poll()); assertEquals("Foo", queue.poll()); assertEquals("buz", queue.poll()); assertEquals("Bar", queue.poll()); assertTrue(queue.isEmpty()); assertTrue(this.map.isEmpty()); queue.add("Foo"); queue.add("Bar"); assertFalse(queue.remove("Toto")); assertEquals(2, queue.size()); assertEquals(2, this.map.size()); }