question: private void compressSamples ( ) { if ( samples . size ( ) < 2 ) { return ; } final ListIterator < SampleItem > it = samples . listIterator ( ) ; SampleItem next = it . next ( ) ; while ( it . hasNext ( ) ) { final SampleItem prev = next ; next = it . next ( ) ; if ( prev . g + next . g + next . delta > allowableError ( it . previousIndex ( ) ) ) { continue ; } next . g += prev . g ; it . previous ( ) ; it . previous ( ) ; it . remove ( ) ; it . next ( ) ; } }
target:  Try to remove extraneous items from the set of sampled items. This checks if an item is unnecessary based on the desired error bounds, and merges it with the adjacent item if it is.