8359996: Remove unnecessary List.indexOf key from Track.remove

Reviewed-by: aivanov, liach, azvegint
This commit is contained in:
Andrey Turbanov 2025-06-23 08:32:02 +00:00
parent 516197f50b
commit fe7ec31259

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -198,15 +198,8 @@ public final class Track {
// Or: document that the ticks() length will not be reduced
// by deleting events (unless the EOT event is removed)
synchronized(eventsList) {
if (set.remove(event)) {
int i = eventsList.indexOf(event);
if (i >= 0) {
eventsList.remove(i);
return true;
}
}
return set.remove(event) && eventsList.remove(event);
}
return false;
}
/**