Skip to content

scijava/scijava-listeners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

34 Commits

Repository files navigation

Build Status

scijava-listeners

Helper class for maintaining lists of listeners.

Usage example:

publicinterfaceMyListener{voidsomethingChanged()} publicclassListenable{// Create a variant of Listeners.ListprivatefinalListeners.List< MyListener > listeners = newListeners.SynchronizedList<>(); // Use Listeners.List.list to call registered listenersprivatevoidnotifyListeners(){listeners.list.forEach( MyListener::somethingChanged )} // expose only Listeners (not Listeners.List) to allow un/registering listenerspublicListeners< MyListener > myListeners(){returnlisteners} } publicclassListening{publicListening( Listenablel ){l.myListeners().add( this::notifyMe )} voidnotifyMe(){System.out.println( "something changed!")} }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages