@Override
    public synchronized E get(int index) {
        int bitIndex = -1;
        if (index < 0) {
            throw new IndexOutOfBoundsException();
        }
        if (index >= rootSet.cardinality()) {
            if (CollectionUtils.isNotEmpty(tailList)) {
                return tailList.get(index - rootSet.cardinality());
            } else {
                throw new IndexOutOfBoundsException();
            }
        } else {
            for (int i = 0; i <= index; i++) {
                bitIndex = rootSet.nextSetBit(bitIndex + 1);
            }
            return originList.get(bitIndex);
        }
    }
@Test
    void testGet() {
        List<String> list = Arrays.asList("A", "B", "C");
        BitList<String> bitList = new BitList<>(list);

        Assertions.assertEquals("A", bitList.get(0));
        Assertions.assertEquals("B", bitList.get(1));
        Assertions.assertEquals("C", bitList.get(2));

        Assertions.assertThrows(IndexOutOfBoundsException.class, () -> bitList.get(-1));
        Assertions.assertThrows(IndexOutOfBoundsException.class, () -> bitList.get(3));

        bitList.add("D");
        Assertions.assertEquals("D", bitList.get(3));

        Assertions.assertThrows(IndexOutOfBoundsException.class, () -> bitList.get(-1));
        Assertions.assertThrows(IndexOutOfBoundsException.class, () -> bitList.get(4));
        Assertions.assertThrows(IndexOutOfBoundsException.class, () -> bitList.get(5));
    }