protected T removeMin() {
        if (tail == null) {
            return null;
        }
        size--;
        count -= tail.count;
        T minElement = tail.element;
        tail = tail.prev;
        if (tail != null) {
            tail.next = null;
        }
        sampleMap.remove(minElement);
        return minElement;
    }
@Test
    public void testRemoveMin() {
        // Empty set
        assertNull(set.removeMin());
        assertEquals(0, set.size());
        assertEquals(0L, set.count());

        // Maintaining order        
        set.put(e[0]);
        for (int i = 0; i < 2; i++) {
            set.put(e[1]);
        }

        for (int i = 0; i < 3; i++) {
            set.put(e[2]);
        }

        assertEquals(3, set.size());
        assertEquals(6L, set.count());

        assertEquals(e[0], set.removeMin());
        assertEquals(2, set.size());
        assertEquals(5L, set.count());

        assertEquals(e[1], set.removeMin());
        assertEquals(1, set.size());
        assertEquals(3L, set.count());

        assertEquals(e[2], set.removeMin());
        assertEquals(0, set.size());
        assertEquals(0L, set.count());

        assertEquals(null, set.removeMin());
        assertEquals(0, set.size());
        assertEquals(0L, set.count());
    }