private static void checkNullElements(final Collection<?> c) {
        if (c instanceof RandomAccess && c instanceof List) {
            // produce less garbage
            final List<?> list = (List<?>) c;
            final int size = list.size();
            for (int i = 0; i < size; i++) {
                if (list.get(i) == null) {
                    throw new IllegalArgumentException("c contains null values");
                }
            }
        } else {
            for (final Object element : c) {
                if (element == null) {
                    throw new IllegalArgumentException("c contains null values");
                }
            }
        }
    }
You must first check to make sure that {@link #isSingletonList()}
returns true.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/storage/KVStateOutputList.java