You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/08/26 18:50:05 UTC
svn commit: r989817 - in /pivot/trunk/core/src/org/apache/pivot:
collections/Collection.java util/ListenerList.java
Author: gbrown
Date: Thu Aug 26 16:50:04 2010
New Revision: 989817
URL: http://svn.apache.org/viewvc?rev=989817&view=rev
Log:
Resolve PIVOT-611.
Modified:
pivot/trunk/core/src/org/apache/pivot/collections/Collection.java
pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Collection.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Collection.java?rev=989817&r1=989816&r2=989817&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Collection.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Collection.java Thu Aug 26 16:50:04 2010
@@ -30,6 +30,10 @@ public interface Collection<T> extends I
/**
* Tests the emptiness of the collection.
+ *
+ * @return
+ * <tt>true</tt> if the collection contains no elements; <tt>false</tt>,
+ * otherwise.
*/
public boolean isEmpty();
Modified: pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java?rev=989817&r1=989816&r2=989817&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java Thu Aug 26 16:50:04 2010
@@ -140,6 +140,36 @@ public abstract class ListenerList<T> im
}
}
+ /**
+ * Tests the existence of a listener in the list.
+ *
+ * @param listener
+ *
+ * @return
+ * <tt>true</tt> if the listener exists in the list; <tt>false</tt>,
+ * otherwise.
+ */
+ public boolean contains(T listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener is null.");
+ }
+
+ Node node = first;
+ while (node != null
+ && node.listener != listener) {
+ node = node.next;
+ }
+
+ return (node != null);
+ }
+
+ /**
+ * Tests the emptiness of the list.
+ *
+ * @return
+ * <tt>true</tt> if the list contains no listeners; <tt>false</tt>,
+ * otherwise.
+ */
public boolean isEmpty() {
return (first == null);
}