### Question:
ParallelAggregation { public static RoaringBitmap xor(RoaringBitmap... bitmaps) { return groupByKey(bitmaps) .entrySet() .parallelStream() .collect(XOR); }  static SortedMap<Character, List<Container>> groupByKey(RoaringBitmap... bitmaps); static RoaringBitmap or(RoaringBitmap... bitmaps); static RoaringBitmap xor(RoaringBitmap... bitmaps);  }### Answer:
@Test public void singleContainerXOR() { RoaringBitmap one = testCase().withRunAt(0).build(); RoaringBitmap two = testCase().withBitmapAt(0).build(); RoaringBitmap three = testCase().withArrayAt(0).build(); assertEquals(FastAggregation.xor(one, two, three), ParallelAggregation.xor(one, two, three)); }
@Test public void missingMiddleContainerXOR() { RoaringBitmap one = testCase().withRunAt(0).withBitmapAt(1).withArrayAt(2).build(); RoaringBitmap two = testCase().withBitmapAt(0).withArrayAt(2).build(); RoaringBitmap three = testCase().withArrayAt(0).withBitmapAt(1).withArrayAt(2).build(); assertEquals(FastAggregation.xor(one, two, three), ParallelAggregation.xor(one, two, three)); }
@Test public void twoContainerXOR() { RoaringBitmap one = testCase().withRunAt(0).withArrayAt(1).build(); RoaringBitmap two = testCase().withBitmapAt(1).build(); RoaringBitmap three = testCase().withArrayAt(1).build(); assertEquals(FastAggregation.xor(one, two, three), ParallelAggregation.xor(one, two, three)); }
@Test public void disjointXOR() { RoaringBitmap one = testCase().withRunAt(0).withArrayAt(2).build(); RoaringBitmap two = testCase().withBitmapAt(1).build(); RoaringBitmap three = testCase().withArrayAt(3).build(); assertEquals(FastAggregation.xor(one, two, three), ParallelAggregation.xor(one, two, three)); }
@Test public void disjointBigKeysXOR() { RoaringBitmap one = testCase().withRunAt(0).withArrayAt(2).withBitmapAt((1 << 15) | 1).build(); RoaringBitmap two = testCase().withBitmapAt(1).withRunAt((1 << 15) | 2).build(); RoaringBitmap three = testCase().withArrayAt(3).withRunAt((1 << 15) | 3).build(); assertEquals(FastAggregation.xor(one, two, three), ParallelAggregation.xor(one, two, three)); }