ToArray creates a new slice containing all of the integers stored in the Bitmap in sorted order
()
| 215 | |
| 216 | // ToArray creates a new slice containing all of the integers stored in the Bitmap in sorted order |
| 217 | func (rb *Bitmap) ToArray() []uint64 { |
| 218 | array := make([]uint64, rb.GetCardinality()) |
| 219 | pos := 0 |
| 220 | pos2 := uint64(0) |
| 221 | |
| 222 | for pos < rb.highlowcontainer.size() { |
| 223 | hs := uint64(rb.highlowcontainer.getKeyAtIndex(pos)) << 32 |
| 224 | c := rb.highlowcontainer.getContainerAtIndex(pos) |
| 225 | pos++ |
| 226 | c.ManyIterator().NextMany64(hs, array[pos2:]) |
| 227 | pos2 += c.GetCardinality() |
| 228 | } |
| 229 | return array |
| 230 | } |
| 231 | |
| 232 | // GetSizeInBytes estimates the memory usage of the Bitmap. Note that this |
| 233 | // might differ slightly from the amount of bytes required for persistent storage |