public void addListener ( FileChangedListener fileListener ) { // Don't add if its already there for ( Iterator < WeakReference < FileChangedListener > > i = listeners_ . iterator ( ) ; i . hasNext ( ) ; ) { WeakReference < FileChangedListener > reference = i . next ( ) ; FileChangedListener listener = reference . get ( ) ; if ( listener == fileListener ) return ; } // Use WeakReference to avoid memory leak if this becomes the // sole reference to the object. listeners_ . add ( new WeakReference < FileChangedListener > ( fileListener ) ) ; }
Add listener to this file monitor .