Author: rwhitcomb Date: Mon Nov 6 16:28:11 2017 New Revision: 1814427 URL: http://svn.apache.org/viewvc?rev=1814427&view=rev Log: PIVOT-999: Update the remaining classes in Collections to use "forEach" for their listener lists.
Modified: pivot/trunk/core/src/org/apache/pivot/collections/List.java pivot/trunk/core/src/org/apache/pivot/collections/Map.java pivot/trunk/core/src/org/apache/pivot/collections/Queue.java pivot/trunk/core/src/org/apache/pivot/collections/Set.java pivot/trunk/core/src/org/apache/pivot/collections/Stack.java Modified: pivot/trunk/core/src/org/apache/pivot/collections/List.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/List.java?rev=1814427&r1=1814426&r2=1814427&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/List.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/List.java Mon Nov 6 16:28:11 2017 @@ -49,37 +49,27 @@ public interface List<T> extends Sequenc ListListener<T> { @Override public void itemInserted(List<T> list, int index) { - for (ListListener<T> listener : this) { - listener.itemInserted(list, index); - } + forEach(listener -> listener.itemInserted(list, index)); } @Override public void itemsRemoved(List<T> list, int index, Sequence<T> items) { - for (ListListener<T> listener : this) { - listener.itemsRemoved(list, index, items); - } + forEach(listener -> listener.itemsRemoved(list, index, items)); } @Override public void itemUpdated(List<T> list, int index, T previousItem) { - for (ListListener<T> listener : this) { - listener.itemUpdated(list, index, previousItem); - } + forEach(listener -> listener.itemUpdated(list, index, previousItem)); } @Override public void listCleared(List<T> list) { - for (ListListener<T> listener : this) { - listener.listCleared(list); - } + forEach(listener -> listener.listCleared(list)); } @Override public void comparatorChanged(List<T> list, Comparator<T> previousComparator) { - for (ListListener<T> listener : this) { - listener.comparatorChanged(list, previousComparator); - } + forEach(listener -> listener.comparatorChanged(list, previousComparator)); } } Modified: pivot/trunk/core/src/org/apache/pivot/collections/Map.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Map.java?rev=1814427&r1=1814426&r2=1814427&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/Map.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/Map.java Mon Nov 6 16:28:11 2017 @@ -31,37 +31,27 @@ public interface Map<K, V> extends Dicti MapListener<K, V> { @Override public void valueAdded(Map<K, V> map, K key) { - for (MapListener<K, V> listener : this) { - listener.valueAdded(map, key); - } + forEach(listener -> listener.valueAdded(map, key)); } @Override public void valueRemoved(Map<K, V> map, K key, V value) { - for (MapListener<K, V> listener : this) { - listener.valueRemoved(map, key, value); - } + forEach(listener -> listener.valueRemoved(map, key, value)); } @Override public void valueUpdated(Map<K, V> map, K key, V previousValue) { - for (MapListener<K, V> listener : this) { - listener.valueUpdated(map, key, previousValue); - } + forEach(listener -> listener.valueUpdated(map, key, previousValue)); } @Override public void mapCleared(Map<K, V> map) { - for (MapListener<K, V> listener : this) { - listener.mapCleared(map); - } + forEach(listener -> listener.mapCleared(map)); } @Override public void comparatorChanged(Map<K, V> map, Comparator<K> previousComparator) { - for (MapListener<K, V> listener : this) { - listener.comparatorChanged(map, previousComparator); - } + forEach(listener -> listener.comparatorChanged(map, previousComparator)); } } Modified: pivot/trunk/core/src/org/apache/pivot/collections/Queue.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Queue.java?rev=1814427&r1=1814426&r2=1814427&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/Queue.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/Queue.java Mon Nov 6 16:28:11 2017 @@ -32,30 +32,22 @@ public interface Queue<T> extends Collec QueueListener<T> { @Override public void itemEnqueued(Queue<T> queue, T item) { - for (QueueListener<T> listener : this) { - listener.itemEnqueued(queue, item); - } + forEach(listener -> listener.itemEnqueued(queue, item)); } @Override public void itemDequeued(Queue<T> queue, T item) { - for (QueueListener<T> listener : this) { - listener.itemDequeued(queue, item); - } + forEach(listener -> listener.itemDequeued(queue, item)); } @Override public void queueCleared(Queue<T> queue) { - for (QueueListener<T> listener : this) { - listener.queueCleared(queue); - } + forEach(listener -> listener.queueCleared(queue)); } @Override public void comparatorChanged(Queue<T> queue, Comparator<T> previousComparator) { - for (QueueListener<T> listener : this) { - listener.comparatorChanged(queue, previousComparator); - } + forEach(listener -> listener.comparatorChanged(queue, previousComparator)); } } Modified: pivot/trunk/core/src/org/apache/pivot/collections/Set.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Set.java?rev=1814427&r1=1814426&r2=1814427&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/Set.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/Set.java Mon Nov 6 16:28:11 2017 @@ -31,30 +31,22 @@ public interface Set<E> extends Group<E> SetListener<E> { @Override public void elementAdded(Set<E> set, E element) { - for (SetListener<E> listener : this) { - listener.elementAdded(set, element); - } + forEach(listener -> listener.elementAdded(set, element)); } @Override public void elementRemoved(Set<E> set, E element) { - for (SetListener<E> listener : this) { - listener.elementRemoved(set, element); - } + forEach(listener -> listener.elementRemoved(set, element)); } @Override public void setCleared(Set<E> set) { - for (SetListener<E> listener : this) { - listener.setCleared(set); - } + forEach(listener -> listener.setCleared(set)); } @Override public void comparatorChanged(Set<E> set, Comparator<E> previousComparator) { - for (SetListener<E> listener : this) { - listener.comparatorChanged(set, previousComparator); - } + forEach(listener -> listener.comparatorChanged(set, previousComparator)); } } Modified: pivot/trunk/core/src/org/apache/pivot/collections/Stack.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Stack.java?rev=1814427&r1=1814426&r2=1814427&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/Stack.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/Stack.java Mon Nov 6 16:28:11 2017 @@ -32,30 +32,22 @@ public interface Stack<T> extends Collec StackListener<T> { @Override public void itemPushed(Stack<T> stack, T item) { - for (StackListener<T> listener : this) { - listener.itemPushed(stack, item); - } + forEach(listener -> listener.itemPushed(stack, item)); } @Override public void itemPopped(Stack<T> stack, T item) { - for (StackListener<T> listener : this) { - listener.itemPopped(stack, item); - } + forEach(listener -> listener.itemPopped(stack, item)); } @Override public void stackCleared(Stack<T> stack) { - for (StackListener<T> listener : this) { - listener.stackCleared(stack); - } + forEach(listener -> listener.stackCleared(stack)); } @Override public void comparatorChanged(Stack<T> stack, Comparator<T> previousComparator) { - for (StackListener<T> listener : this) { - listener.comparatorChanged(stack, previousComparator); - } + forEach(listener -> listener.comparatorChanged(stack, previousComparator)); } }