PlacementData { void removeItem(final int originalPosition) { int indexToDecrement = binarySearchGreaterThan( mDesiredOriginalPositions, mDesiredCount, originalPosition); for (int i = indexToDecrement; i < mDesiredCount; ++i) { mDesiredOriginalPositions[i]--; mDesiredInsertionPositions[i]--; } indexToDecrement = binarySearchGreaterThan( mOriginalAdPositions, mPlacedCount, originalPosition); for (int i = indexToDecrement; i < mPlacedCount; ++i) { mOriginalAdPositions[i]--; mAdjustedAdPositions[i]--; } } private  PlacementData(@NonNull final int[] desiredInsertionPositions);  final static int NOT_FOUND; }
@Test public void removeItems_beforePlacing() { checkInsertionPositions(7, adsAt15repeating, 1, 4, 6); adsAt15repeating.removeItem(4); checkInsertionPositions(7, adsAt15repeating, 1, 4, 5, 7); }