Community
Participate
Working Groups
The method org.eclipse.jface.util.ListenerList#remove(Object) does a lot of work to maintain the ordering of the items in the list. The ListenerList API doesn't say that the list is an ordered list, however, so this work isn't necessary. Instead of removing the element and shifting all elements to close the gap, the list should just replace the removed element with the last element in the array, null the last element in the array, and decrement the item count.
Created attachment 1989 [details] listenerlistpatch.txt - a proposed patch
Although it's not spec'ed, the fact that the listener list preserves order is important. If there are real cases where the performance of the current implementation is unacceptable, then we can reconsider the implementation, e.g. use a linked list. The spec should be clarified re order.
Changed getListeners() to state: * Returns an array containing all the registered listeners, * in the order in which they were added.