### Question:
MapBasedLinkedBlockingQueue implements BlockingQueue<T> { @Override public T take() throws InterruptedException { Pair<Long, T> result = this.internalQueue.take(); this.internalRemove(result); return result.getValue(); } 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 take() throws Exception { BlockingQueue<String> queue = new MapBasedLinkedBlockingQueue(this.map); assertEquals(4, queue.size()); assertEquals("Baz", queue.take()); assertEquals("Foo", queue.take()); assertEquals("Bar", queue.take()); assertEquals("buz", queue.take()); assertTrue(queue.isEmpty()); assertTrue(this.map.isEmpty()); }