Circuits { public static <Filter> SplitMap evaluate(QueryContext<Filter, ?> context, Function<Slice<Filter, Container>, Container> circuit, Filter... filters) { return new SplitMap(groupByKey(context, EMPTY, filters) .streamUniformPartitions() .parallel() .collect(new IndexAggregator<>(circuit))); }  static SplitMap evaluateIfKeysIntersect(QueryContext<Filter, ?> context,
                                   Function<Slice<Filter, Container>, Container> circuit,
                                   Filter... filters); static SplitMap evaluate(QueryContext<Filter, ?> context,
                    Function<Slice<Filter, Container>, Container> circuit,
                    Filter... filters);  }
@Test public void testCircuit() { SplitMapPageWriter w1 = new SplitMapPageWriter(); w1.add(0); w1.add(1); w1.add(1 << 16); w1.add(1 << 16 | 1); w1.add(1 << 17 | 1); SplitMapPageWriter w2 = new SplitMapPageWriter(); w2.add(0); w2.add(2); w2.add(1 << 16); w2.add(1 << 16 | 2); w2.add(1 << 17 | 2); SplitMap result = Circuits.evaluate(contextOf(w1, w2), slice -> null == slice ? null : slice.get(0).xor(slice.get(1)), 0, 1); assertTrue(result.contains(1)); assertTrue(result.contains(2)); assertTrue(result.contains(1 << 16 | 1)); assertTrue(result.contains(1 << 16 | 2)); assertTrue(result.contains(1 << 17 | 1)); assertTrue(result.contains(1 << 17 | 2)); }