File tree Expand file tree Collapse file tree 3 files changed +330
-372
lines changed
main/java/ai/timefold/solver/core/impl/bavet/common
test/java/ai/timefold/solver/core/impl/bavet/common/index Expand file tree Collapse file tree 3 files changed +330
-372
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,11 @@ final class ExistsCounterHandle<LeftTuple_ extends AbstractTuple> {
2929 }
3030
3131 public void removeByLeft () {
32- rightHandleSet .remove (this );
32+ rightHandleSet .remove (this ); // The counter will be removed from the left handle set by the caller.
3333 }
3434
3535 public void removeByRight () {
36- counter .leftHandleSet .remove (this );
36+ counter .leftHandleSet .remove (this ); // The counter will be removed from the right handle set by the caller.
3737 }
3838
3939}
Original file line number Diff line number Diff line change @@ -285,16 +285,12 @@ public void clear(Consumer<T> elementConsumer) {
285285 forceClear ();
286286 return ;
287287 }
288- var oldLastElementPosition = lastElementPosition ;
289- for (var i = 0 ; i <= oldLastElementPosition ; i ++) {
288+ for (var i = 0 ; i <= lastElementPosition ; i ++) {
290289 var element = elementList .get (i );
291290 if (element == null ) {
292291 continue ;
293292 }
294293 elementConsumer .accept (element );
295- if (lastElementPosition != oldLastElementPosition ) {
296- throw new IllegalStateException ("Impossible state: the IndexedSet was modified while being cleared." );
297- }
298294 elementPositionTracker .clearPosition (element );
299295 // We can stop early once all non-gap elements have been processed.
300296 nonGapCount --;
You can’t perform that action at this time.
0 commit comments