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