pub fn new_dense<T>(len: usize) -> PartialArrayBuilder<T, BitVec<Box<[usize]>>>Expand description
Creates a new builder for a dense partial array of the given length.
A dense partial array stores a bit vector of the given length to mark which positions contain values, and use ranking on this bit vector to map positions to indices in a contiguous value array.
If your set of values is really sparse, consider using a sparse partial array.
ยงExamples
use sux::array::partial_array;
let mut builder = partial_array::new_dense(10);
builder.set(1, "foo");
builder.set(2, "hello");
builder.set(7, "world");
let array = builder.build();
assert_eq!(array.get(1), Some(&"foo"));
assert_eq!(array.get(2), Some(&"hello"));
assert_eq!(array.get(3), None);
assert_eq!(array.get(7), Some(&"world"));