{"action":"created","issue":{"url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/36","labels_url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/36/comments","events_url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/36/events","html_url":"https://github.com/lemire/RoaringBitmap/issues/36","id":98119639,"number":36,"title":"Feature Request: Set operations","user":{"login":"llogiq","id":4200835,"avatar_url":"https://avatars.githubusercontent.com/u/4200835?v=3","gravatar_id":"","url":"https://api.github.com/users/llogiq","html_url":"https://github.com/llogiq","followers_url":"https://api.github.com/users/llogiq/followers","following_url":"https://api.github.com/users/llogiq/following{/other_user}","gists_url":"https://api.github.com/users/llogiq/gists{/gist_id}","starred_url":"https://api.github.com/users/llogiq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llogiq/subscriptions","organizations_url":"https://api.github.com/users/llogiq/orgs","repos_url":"https://api.github.com/users/llogiq/repos","events_url":"https://api.github.com/users/llogiq/events{/privacy}","received_events_url":"https://api.github.com/users/llogiq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-30T09:09:36Z","updated_at":"2015-07-30T13:28:18Z","closed_at":null,"body":"It should be possible to implement fairly fast set operations like `intersects(RoaringBitmap)` (a method that even `BitSet` has) and `containsAll(RoaringBitmap)` (a method that `BitSet` lacks, but could be quite handy in some cases).\r\n\r\nAlso a fast method to *count* the bits of intersections/unions might be useful (I'm using RoaringBitmaps for a Jaccard Index, where both is needed – so a method that does both fast would be even more awesome). Granted, the latter is really specific, so I have no hard feelings if it doesn't get implemented.\r\n\r\nPerhaps providing a method `Stream<Pair> pairStream(RoaringBitmap, RoaringBitmap)` where each `Pair` has an index + two longs with the bits wherever at least one of the bitmaps has bits could be used to solve all of the above issues in a generic way?"},"comment":{"url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/comments/126323957","html_url":"https://github.com/lemire/RoaringBitmap/issues/36#issuecomment-126323957","issue_url":"https://api.github.com/repos/lemire/RoaringBitmap/issues/36","id":126323957,"user":{"login":"lemire","id":391987,"avatar_url":"https://avatars.githubusercontent.com/u/391987?v=3","gravatar_id":"","url":"https://api.github.com/users/lemire","html_url":"https://github.com/lemire","followers_url":"https://api.github.com/users/lemire/followers","following_url":"https://api.github.com/users/lemire/following{/other_user}","gists_url":"https://api.github.com/users/lemire/gists{/gist_id}","starred_url":"https://api.github.com/users/lemire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemire/subscriptions","organizations_url":"https://api.github.com/users/lemire/orgs","repos_url":"https://api.github.com/users/lemire/repos","events_url":"https://api.github.com/users/lemire/events{/privacy}","received_events_url":"https://api.github.com/users/lemire/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T13:28:18Z","updated_at":"2015-07-30T13:28:18Z","body":"> It should be possible to implement fairly fast set operations like intersects(RoaringBitmap) (a method that even BitSet has) \r\n\r\nYou are correct. This should be added.\r\n\r\n> and containsAll(RoaringBitmap) (a method that BitSet lacks, but could be quite handy in some cases)\r\n\r\nThis could be added for convenience, but it can be implemented as ```(RoaringBitmap.xor(first,second).getCardinality() == 0)```.\r\n\r\n> Also a fast method to count the bits of intersections/unions might be useful\r\n\r\nAgreed. This should be added as well.\r\n\r\n> Perhaps providing a method Stream<Pair> pairStream(RoaringBitmap, RoaringBitmap) where each Pair has an index + two longs with the bits wherever at least one of the bitmaps has bits could be used to solve all of the above issues in a generic way?\r\n\r\nI do not understand this proposal. Can you give an example?"}}