[8u] API Request: RT-25613, ObservableValue should have a hasListener(listener) method

Martin Sladecek martin.sladecek at oracle.com
Wed Jan 22 04:45:07 PST 2014

On 01/22/2014 12:30 PM, Richard Bair wrote:
>>> The default implementation (for Observable) would look like this:
>>> public default void ensureListener(InvalidationListener listener) {
>>>     removeListener(listener);
>>>     addListener(listener);
>>> }
>>> subclasses might do something more effective. The same would apply to
>>> ObservableValue and ChangeListener and Observable[List|Set|Map] and
>>> [List|Set|Map]ChangeListener.
>> Well this would destroy the order! I expect listeners to be called in
>> the correct order not?
> That’s a good point :-(

Actually even when you would rely on the order, in situations when you 
call ensureListener, you don't really know if the listener is already 
there. So you might really expect that listener would be added at this 
point as the last. It's just that will always be the outcome if the 
default implementation is used.


More information about the openjfx-dev mailing list