public void assertConsistency() { if (queue instanceof SynchronizedQueue) { ((SynchronizedQueue) queue).assertConsistency(); } int mapSize = map.size(); int effectiveQueueSize = queue.size(); if (effectiveQueueSize != mapSize) { throw new AssertionError( "The map size is " + mapSize + " is different from the queue size " + effectiveQueueSize); } }