@SuppressWarnings("unchecked") @Test public void testCombine() { List<Long> listA = Arrays.asList(1L, 2L); List<Long> listB = Arrays.asList(3L, 4L); List<Long> req = Arrays.asList(1L, 2L, 3L, 4L); PartialMapperResponse<List<Long>, List<Long>> response = new PartialMapperResponse<List<Long>, List<Long>>( listA, new LinkedList<Long>(Arrays.asList(3L, 4L))); List<Long> results = sut.combine(response, listB, req); Assert.assertEquals(4, results.size()); Assert.assertTrue(results.contains(1L)); Assert.assertTrue(results.contains(2L)); Assert.assertTrue(results.contains(3L)); Assert.assertTrue(results.contains(4L)); }
public List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse, final List<Type> response2, final List<Request> request) { List<Type> allItems = new ArrayList<Type>(); int partialIndex = 0; int remainingIndex = 0; for (Request req : request) { if (partialResponse.getUnhandledRequest().contains(req) && remainingIndex < response2.size()) { allItems.add(response2.get(remainingIndex)); remainingIndex++; } else if (partialIndex < partialResponse.getResponse().size()) { allItems.add(partialResponse.getResponse().get(partialIndex)); partialIndex++; } } return allItems; }
CollectionCombiner implements ResultsCombinerStrategy<List<Request>, List<Type>> { public List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse, final List<Type> response2, final List<Request> request) { List<Type> allItems = new ArrayList<Type>(); int partialIndex = 0; int remainingIndex = 0; for (Request req : request) { if (partialResponse.getUnhandledRequest().contains(req) && remainingIndex < response2.size()) { allItems.add(response2.get(remainingIndex)); remainingIndex++; } else if (partialIndex < partialResponse.getResponse().size()) { allItems.add(partialResponse.getResponse().get(partialIndex)); partialIndex++; } } return allItems; } }
CollectionCombiner implements ResultsCombinerStrategy<List<Request>, List<Type>> { public List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse, final List<Type> response2, final List<Request> request) { List<Type> allItems = new ArrayList<Type>(); int partialIndex = 0; int remainingIndex = 0; for (Request req : request) { if (partialResponse.getUnhandledRequest().contains(req) && remainingIndex < response2.size()) { allItems.add(response2.get(remainingIndex)); remainingIndex++; } else if (partialIndex < partialResponse.getResponse().size()) { allItems.add(partialResponse.getResponse().get(partialIndex)); partialIndex++; } } return allItems; }  }
CollectionCombiner implements ResultsCombinerStrategy<List<Request>, List<Type>> { public List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse, final List<Type> response2, final List<Request> request) { List<Type> allItems = new ArrayList<Type>(); int partialIndex = 0; int remainingIndex = 0; for (Request req : request) { if (partialResponse.getUnhandledRequest().contains(req) && remainingIndex < response2.size()) { allItems.add(response2.get(remainingIndex)); remainingIndex++; } else if (partialIndex < partialResponse.getResponse().size()) { allItems.add(partialResponse.getResponse().get(partialIndex)); partialIndex++; } } return allItems; }  List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse,
            final List<Type> response2, final List<Request> request); }
CollectionCombiner implements ResultsCombinerStrategy<List<Request>, List<Type>> { public List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse, final List<Type> response2, final List<Request> request) { List<Type> allItems = new ArrayList<Type>(); int partialIndex = 0; int remainingIndex = 0; for (Request req : request) { if (partialResponse.getUnhandledRequest().contains(req) && remainingIndex < response2.size()) { allItems.add(response2.get(remainingIndex)); remainingIndex++; } else if (partialIndex < partialResponse.getResponse().size()) { allItems.add(partialResponse.getResponse().get(partialIndex)); partialIndex++; } } return allItems; }  List<Type> combine(final PartialMapperResponse<List<Request>, List<Type>> partialResponse,
            final List<Type> response2, final List<Request> request);  }