String getStatistics ( ) { String msg = "PropertyChanges stats :\r\n" + "# registered handlers : " + nbRegisteredHandlers + "\r\n" + "# notifications : " + nbNotifications + "\r\n" + "# dispatches : " + nbDispatches + "\r\n" ; StringBuilder details = new StringBuilder ( ) ; for ( Entry < String , Integer > e : counts . entrySet ( ) ) { details . append ( e . getKey ( ) + " => " + e . getValue ( ) ) ; Integer oldCount = oldCounts . get ( e . getKey ( ) ) ; if ( oldCount != null ) details . append ( " (diff: " + ( e . getValue ( ) - oldCount ) + ")" ) ; details . append ( "\n" ) ; } oldCounts = new HashMap <> ( counts ) ; return msg + details . toString ( ) ; }
Show an alert containing useful information for debugging . It also shows how many registrations happened since last call ; that s useful to detect registration leaks .