@Override
    public Range<T> lastRange() {
        if (rangeBitSetMap.isEmpty()) {
            return null;
        }
        Entry<Long, BitSet> lastSet = rangeBitSetMap.lastEntry();
        int upper = lastSet.getValue().previousSetBit(lastSet.getValue().size());
        int lower = Math.min(lastSet.getValue().previousClearBit(upper), upper);
        return Range.openClosed(consumer.apply(lastSet.getKey(), lower), consumer.apply(lastSet.getKey(), upper));
    }
@Test
    public void testLastRange() {
        OpenLongPairRangeSet<LongPair> set = new OpenLongPairRangeSet<>(consumer);
        assertNull(set.lastRange());
        Range<LongPair> range = Range.openClosed(new LongPair(0, 97), new LongPair(0, 99));
        set.add(range);
        assertEquals(set.lastRange(), range);
        assertEquals(set.size(), 1);
        range = Range.openClosed(new LongPair(0, 98), new LongPair(0, 105));
        set.add(range);
        assertEquals(set.lastRange(), Range.openClosed(new LongPair(0, 97), new LongPair(0, 105)));
        assertEquals(set.size(), 1);
        range = Range.openClosed(new LongPair(1, 5), new LongPair(1, 75));
        set.add(range);
        assertEquals(set.lastRange(), range);
        assertEquals(set.size(), 2);
        range = Range.openClosed(new LongPair(1, 80), new LongPair(1, 120));
        set.add(range);
        assertEquals(set.lastRange(), range);
        assertEquals(set.size(), 3);
    }