private void remove( Sorted<Integer> sorted, int startIndex, int nrIterations, int[] itemsToRemove) { for (int i = startIndex; i < startIndex + nrIterations; i++) { sleep(); sorted.remove(itemsToRemove[i]); } }
private void add(Sorted<Integer> sorted, int startIndex, int nrIterations, int[] itemsToAdd) { for (int i = startIndex; i < startIndex + nrIterations; i++) { sleep(); sorted.add(itemsToAdd[i]); } }