Class ListenerList<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      ListenerList()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, T listener)
      Inserts a new listener to the specified position in the list.
      void add​(T listener)
      Adds a listener to the list, if it has not previously been added.
      boolean contains​(T listener)
      Tests the existence of a listener in the list.
      T get​(int index)
      Get the indexed element in the list.
      int getLength()
      Get the number of elements in the list.
      boolean isEmpty()
      Tests the emptiness of the list.
      java.util.Iterator<T> iterator()  
      void remove​(T listener)
      Removes a listener from the list, if it has previously been added.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • ListenerList

        public ListenerList()
    • Method Detail

      • add

        public void add​(T listener)
        Adds a listener to the list, if it has not previously been added.
        Parameters:
        listener - New listener to add to the list.
      • add

        public void add​(int index,
                        T listener)
        Inserts a new listener to the specified position in the list.
        Parameters:
        index - The 0-based position in the list where to add the new listener.
        listener - New listener to add there.
      • remove

        public void remove​(T listener)
        Removes a listener from the list, if it has previously been added.
        Parameters:
        listener - The listener to remove from the list.
      • contains

        public boolean contains​(T listener)
        Tests the existence of a listener in the list.
        Parameters:
        listener - The listener to test.
        Returns:
        true if the listener exists in the list; false, otherwise.
      • isEmpty

        public boolean isEmpty()
        Tests the emptiness of the list.
        Returns:
        true if the list contains no listeners; false, otherwise.
      • getLength

        public int getLength()
        Get the number of elements in the list.
        Returns:
        the number of elements.
      • get

        public T get​(int index)
        Get the indexed element in the list.
        Parameters:
        index - Position of the element to retrieve.
        Returns:
        The element at position index.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range.
      • iterator

        public final java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object