# scijava-listeners **Repository Path**: mirrors_scijava/scijava-listeners ## Basic Information - **Project Name**: scijava-listeners - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2025-10-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Build Status](https://github.com/scijava/scijava-listeners/actions/workflows/build.yml/badge.svg)](https://github.com/scijava/scijava-listeners/actions/workflows/build.yml) # scijava-listeners Helper class for maintaining lists of listeners. Usage example: ```java public interface MyListener { void somethingChanged(); } public class Listenable { // Create a variant of Listeners.List private final Listeners.List< MyListener > listeners = new Listeners.SynchronizedList<>(); // Use Listeners.List.list to call registered listeners private void notifyListeners() { listeners.list.forEach( MyListener::somethingChanged ); } // expose only Listeners (not Listeners.List) to allow un/registering listeners public Listeners< MyListener > myListeners() { return listeners; } } public class Listening { public Listening( Listenable l ) { l.myListeners().add( this::notifyMe ); } void notifyMe() { System.out.println( "something changed!"); } } ```