@Override
    public Range<T> firstRange() {
        if (rangeBitSetMap.isEmpty()) {
            return null;
        }
        Entry<Long, BitSet> firstSet = rangeBitSetMap.firstEntry();
        int lower = firstSet.getValue().nextSetBit(0);
        int upper = Math.max(lower, firstSet.getValue().nextClearBit(lower) - 1);
        return Range.openClosed(consumer.apply(firstSet.getKey(), lower - 1), consumer.apply(firstSet.getKey(), upper));
    }
@Test
    public void testFirstRange() {
        OpenLongPairRangeSet<LongPair> set = new OpenLongPairRangeSet<>(consumer);
        assertNull(set.firstRange());
        Range<LongPair> range = Range.openClosed(new LongPair(0, 97), new LongPair(0, 99));
        set.add(range);
        assertEquals(set.firstRange(), range);
        assertEquals(set.size(), 1);
        range = Range.openClosed(new LongPair(0, 98), new LongPair(0, 105));
        set.add(range);
        assertEquals(set.firstRange(), Range.openClosed(new LongPair(0, 97), new LongPair(0, 105)));
        assertEquals(set.size(), 1);
        range = Range.openClosed(new LongPair(0, 5), new LongPair(0, 75));
        set.add(range);
        assertEquals(set.firstRange(), range);
        assertEquals(set.size(), 2);
    }