Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
138 - implement first and last. https://github.com/RoaringBitmap/Roar… #148
Following on from comments on issue page this implementation adds first() and last() to container implementations. The offset issue is resolved within RoaringArray, which is delegated to by RoaringBitmap. Tests added for a range of values for each container implementation and RoaringBitmap itself.
Yes, it is a carbon copy that works over ByteBuffers instead of arrays. It is annoying that we need to maintain two distinct versions of the same code, but there are significant performance trade-offs involved. The ByteBuffer approach works with off-heap processing... so it can avoid the garbage collection... but it is slower compared to working directly on Java arrays.
Mostly, it is a minor annoyance involving copying and pasting.