Skip to content

DevFaqWeakListenerWhen

Antonio Vieiro edited this page Jan 25, 2018 · 1 revision

DevFaqWeakListenerWhen

When should I use a WeakListener

You should use a WeakListener any time you are adding a listener to an object, but there is no code - and possibly no opportunity - to explicitly remove it.

If the thing you are listening to does have some kind of observable life-cycle, it is preferable to explicitly add and detach listeners.

But in the case that you are adding a listener which is never explicitly removed, it is good form to use WeakListeners

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqWeakListenerWhen , that was last modified by NetBeans user Tboudreau on 2010-01-24T06:12:14Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.

Clone this wiki locally