Buggy code:
validPairs [ k ] [ 1 ] = minJ ; k ++ ; if ( BeeTracker . debug ) { System . out . println ( ( ( ( ( "points<seq2seq4repair_space>(" + minI ) + ",<seq2seq4repair_space>" ) + minJ ) + ")<seq2seq4repair_space>paired" ) ) ; } } else { break ; } } } if ( BeeTracker . debug ) { System . out . println ( ( k + "<seq2seq4repair_space>point(s)<seq2seq4repair_space>paired" ) ) ; } if ( waggleMode ) { waggles = waggleTimes . get ( color ) ; waggleIter = waggleStates . listIterator ( ) ; i = 0 ; while ( waggleIter . hasNext ( ) ) { if ( ! ( waggleIter . next ( ) ) ) { rec . recognize ( oldPaths . get ( i ) , frameDims ) ; waggle = rec . isCandidateRecognized ( ) ; if ( waggle ) { waggleIter . set ( waggle ) ; waggles . append ( time ) ; } } i ++ ; } } else { departures = departureTimes . get ( color ) ; arrivals = arrivalTimes . get ( color ) ; for ( i = 0 ; i < k ; i ++ ) { path = oldPaths . get ( validPairs [ i ] [ 0 ] ) ; point = path . get ( ( ( path . size ( ) ) - 1 ) ) ; oldX = ( ( point [ 0 ] ) * ( frameDims [ 0 ] ) ) + ( frameOffset [ 0 ] ) ; oldY = ( ( point [ 1 ] ) * ( frameDims [ 1 ] ) ) + ( frameOffset [ 1 ] ) ; point = newPoints . get ( validPairs [ i ] [ 1 ] ) ; newX = ( ( point [ 0 ] ) * ( frameDims [ 0 ] ) ) + ( frameOffset [ 0 ] ) ; newY = ( ( point [ 1 ] ) * ( frameDims [ 1 ] ) ) + ( frameOffset [ 1 ] ) ; isOldPointInExit = isInExit ( oldX , oldY , exitCenterXY , exitAxes ) ; isNewPointInExit = isInExit ( newX , newY , exitCenterXY , exitAxes ) ; if ( BeeTracker . debug ) { System . out . println ( ( ( ( ( ( ( ( ( ( "pair<seq2seq4repair_space>" + i ) + ":\nold<seq2seq4repair_space>point<seq2seq4repair_space>" ) + ( validPairs [ i ] [ 0 ] ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>inside<seq2seq4repair_space>exit:<seq2seq4repair_space>" ) + ( isOldPointInExit ? "true" : "false" ) ) + "\nnew<seq2seq4repair_space>point<seq2seq4repair_space>" ) + ( validPairs [ i ] [ 1 ] ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>inside<seq2seq4repair_space>exit:<seq2seq4repair_space>" ) + ( isNewPointInExit ? "true" : "false" ) ) ) ; } if ( isOldPointInExit ) { if ( ! isNewPointInExit ) { departures . append ( time ) ; } } else if ( isNewPointInExit ) { arrivals . append ( time ) ; } } } for ( i = 0 ; i < k ; i ++ ) { path = oldPaths . get ( validPairs [ i ] [ 0 ] ) ; point = newPoints . get ( validPairs [ i ] [ 1 ] ) ; if ( ! ( path . contains ( point ) ) ) { path . add ( point ) ; } newPoints . set ( validPairs [ i ] [ 1 ] , null ) ; timeOuts . set ( validPairs [ i ] [ 0 ] , ( - 1 ) ) ; } j = 1 ; for ( float [ ] newPoint : newPoints ) { if ( newPoint != null ) { path = new ArrayList < > ( ) ; path . add ( newPoint ) ; oldPaths . add ( path ) ; waggleStates . add ( false ) ; timeOuts . append ( 0 ) ; j ++ ; } } if ( BeeTracker . debug ) { System . out . println ( "all<seq2seq4repair_space>paths:" ) ; for ( i = 0 ; i < ( oldPaths . size ( ) ) ; i ++ ) { System . out . println ( ( i + ":" ) ) ; path = oldPaths . get ( i ) ; for ( float [ ] tmpPoint : path ) { System . out . println ( ( ( ( tmpPoint [ 0 ] ) + "," ) + ( tmpPoint [ 1 ] ) ) ) ; } } } waggleIter = waggleStates . listIterator ( ) ; for ( i = ( timeOuts . size ( ) ) - j ; i >= 0 ; i -- ) { timeOuts . increment ( i ) ; <START_BUG> waggle = waggleIter . next ( ) ; <END_BUG> if ( ( timeOuts . get ( i ) ) > ( TrackingUtils . timeOutCount ) ) { timeOuts . remove ( i ) ; oldPaths . remove ( i ) ; waggleIter . remove ( ) ; } } } updateEventTimeline ( parent , time , duration ) ; } void setColors ( IntList newColors ) { } HashMap < Float , String > getSummary ( ) { } private boolean isInExit ( float x , float y , float [ ] exitXY , float [ ] axes ) { } final void init ( ) { } HashMap < Integer , FloatList > getDepartureTimes ( ) { } HashMap < Integer , FloatList > getArrivalTimes ( ) { } HashMap < Integer , FloatList > getWaggleTimes ( ) { } void drawPaths ( PGraphics buf , int [ ] frameDims , int [ ] frameOffset ) { } private void updateEventTimeline ( BeeTracker parent , float time , float duration ) { } PGraphics getEventTimeline ( BeeTracker parent , float time , float duration ) { } void setEventType ( boolean type ) { } }

Fix:
waggleIter . next ( ) ;