MCPcopy
hub / github.com/RoaringBitmap/roaring / equals

Method equals

arraycontainer.go:225–260  ·  view source on GitHub ↗
(o container)

Source from the content-addressed store, hash-verified

223}
224
225func (ac *arrayContainer) equals(o container) bool {
226 srb, ok := o.(*arrayContainer)
227 if ok {
228 // Check if the containers are the same object.
229 if ac == srb {
230 return true
231 }
232
233 if len(srb.content) != len(ac.content) {
234 return false
235 }
236
237 for i, v := range ac.content {
238 if v != srb.content[i] {
239 return false
240 }
241 }
242 return true
243 }
244
245 // use generic comparison
246 bCard := o.getCardinality()
247 aCard := ac.getCardinality()
248 if bCard != aCard {
249 return false
250 }
251
252 ait := ac.getShortIterator()
253 bit := o.getShortIterator()
254 for ait.hasNext() {
255 if bit.next() != ait.next() {
256 return false
257 }
258 }
259 return true
260}
261
262func (ac *arrayContainer) toBitmapContainer() *bitmapContainer {
263 bc := newBitmapContainer()

Callers

nothing calls this directly

Calls 6

getCardinalityMethod · 0.95
getShortIteratorMethod · 0.95
getCardinalityMethod · 0.65
getShortIteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected