Skip to content

Commit fe7ec31

Browse files
author
Andrey Turbanov
committed
8359996: Remove unnecessary List.indexOf key from Track.remove
Reviewed-by: aivanov, liach, azvegint
1 parent 516197f commit fe7ec31

File tree

1 file changed

+2
-9
lines changed
  • src/java.desktop/share/classes/javax/sound/midi

1 file changed

+2
-9
lines changed

src/java.desktop/share/classes/javax/sound/midi/Track.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -198,15 +198,8 @@ public boolean remove(MidiEvent event) {
198198
// Or: document that the ticks() length will not be reduced
199199
// by deleting events (unless the EOT event is removed)
200200
synchronized(eventsList) {
201-
if (set.remove(event)) {
202-
int i = eventsList.indexOf(event);
203-
if (i >= 0) {
204-
eventsList.remove(i);
205-
return true;
206-
}
207-
}
201+
return set.remove(event) && eventsList.remove(event);
208202
}
209-
return false;
210203
}
211204

212205
/**

0 commit comments

Comments
 (0)