Source:
public Map<String, Boolean> putBatchForce(final List<Calibration> calibrations) { if (calibrations.isEmpty()) { return Collections.emptyMap(); } final Map<String, Boolean> putResults = Maps.newHashMap(); final List<Calibration> selectedCalibrations = calibrations.subList(0, Math.min(calibrations.size(), MAX_PUT_FORCE_SIZE)); for (final Calibration selectedCalibration : selectedCalibrations) { putResults.put(selectedCalibration.senseId, Boolean.TRUE); } final List<List<Calibration>> partitionedCalibrationsList = Lists.partition(selectedCalibrations, MAX_PUT_FORCE_SIZE_PER_BATCH); for (final List<Calibration> partitionedCalibrations : partitionedCalibrationsList) { final List<WriteRequest> calibrationPutRequests = new ArrayList<>(); for (final Calibration calibration : partitionedCalibrations) { calibrationPutRequests.add(new WriteRequest().withPutRequest(new PutRequest().withItem(getAttributeMapFromCalibration(calibration)))); } Map<String, List<WriteRequest>> requestItems = new HashMap<>(); requestItems.put(calibrationTableName, calibrationPutRequests); final BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems); try { final BatchWriteItemResult batchWriteItemResult = dynamoDBClient.batchWriteItem(batchWriteItemRequest); final Map<String, List<WriteRequest>> unprocessedItems = batchWriteItemResult.getUnprocessedItems(); for (final WriteRequest writeRequest: unprocessedItems.get(calibrationTableName)) { putResults.put(writeRequest.getPutRequest().getItem().get(SENSE_ATTRIBUTE_NAME).getS(), Boolean.FALSE); } } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } } return putResults; }

Target:
public Map<String, Boolean> putBatchForce(final List<Calibration> calibrations) { if (calibrations.isEmpty()) { return Collections.emptyMap(); } final Map<String, Boolean> putResults = Maps.newHashMap(); for (final Calibration calibration : calibrations) { putResults.put(calibration.senseId, Boolean.TRUE); } final List<List<Calibration>> partitionedCalibrationsList = Lists.partition(calibrations, MAX_PUT_FORCE_SIZE_PER_BATCH); for (final List<Calibration> partitionedCalibrations : partitionedCalibrationsList) { final List<WriteRequest> calibrationPutRequests = new ArrayList<>(); for (final Calibration calibration : partitionedCalibrations) { calibrationPutRequests.add(new WriteRequest().withPutRequest(new PutRequest().withItem(getAttributeMapFromCalibration(calibration)))); } Map<String, List<WriteRequest>> requestItems = Maps.newHashMap(); requestItems.put(calibrationTableName, calibrationPutRequests); final BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems); try { final BatchWriteItemResult batchWriteItemResult = dynamoDBClient.batchWriteItem(batchWriteItemRequest); final Map<String, List<WriteRequest>> unprocessedItems = batchWriteItemResult.getUnprocessedItems(); if (unprocessedItems.containsKey(calibrationTableName)) { for (final WriteRequest writeRequest : unprocessedItems.get(calibrationTableName)) { putResults.put(writeRequest.getPutRequest().getItem().get(SENSE_ATTRIBUTE_NAME).getS(), Boolean.FALSE); } } } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } } return putResults; }