### Question:
RankBlendingItemRecommender extends AbstractItemRecommender { static ResultList merge(int n, ResultList left, ResultList right, double weight) { Long2IntMap leftRanks = LongUtils.itemRanks(LongUtils.asLongList(left.idList())); Long2IntMap rightRanks = LongUtils.itemRanks(LongUtils.asLongList(right.idList())); int nl = left.size(); int nr = right.size(); LongSet allItems = new LongOpenHashSet(); allItems.addAll(leftRanks.keySet()); allItems.addAll(rightRanks.keySet()); ResultAccumulator accum = ResultAccumulator.create(n); for (LongIterator iter = allItems.iterator(); iter.hasNext();) { long item = iter.nextLong(); int rl = leftRanks.get(item); int rr = rightRanks.get(item); double s1 = rankToScore(rl, nl); double s2 = rankToScore(rr, nr); double score = weight * s1 + (1.0-weight) * s2; accum.add(new RankBlendResult(item, score, rl >= 0 ? left.get(rl) : null, rl, rr >= 0 ? right.get(rr) : null, rl)); } return accum.finish(); } @Inject  RankBlendingItemRecommender(@Left ItemRecommender left, @Right ItemRecommender right, @BlendWeight double w);   }### Answer:
@Test public void testBlendScores() { ResultList left = Results.newResultList(Results.create(1, 2.0), Results.create(2, 1.5), Results.create(3, 1.0)); ResultList right = Results.newResultList(Results.create(2, 2.0), Results.create(1, 1.5), Results.create(4, 1.0), Results.create(3, 0.8)); ResultList res = merge(-1, left, right, 0.7); assertThat(res, hasSize(4)); assertThat(res.idList(), contains(1L, 2L, 4L, 3L)); assertThat(res.get(0).getScore(), closeTo(0.7 + 0.2, 1.0e-6)); assertThat(res.get(1).getScore(), closeTo(0.7*0.5 + 0.3, 1.0e-6)); assertThat(res.get(2).getScore(), closeTo(0.1, 1.0e-6)); assertThat(res.get(2).as(RankBlendResult.class).getLeft(), nullValue()); assertThat(res.get(3).getScore(), closeTo(0.0, 1.0e-6)); }