james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r732056 - in /james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address: AddressList.java DomainList.java MailboxList.java
Date Tue, 06 Jan 2009 18:58:27 GMT
Author: mwiederkehr
Date: Tue Jan  6 10:58:27 2009
New Revision: 732056

URL: http://svn.apache.org/viewvc?rev=732056&view=rev
Log:
Implements Iterable to support enhanced for-loops

Modified:
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
    james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java?rev=732056&r1=732055&r2=732056&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/AddressList.java
Tue Jan  6 10:58:27 2009
@@ -24,12 +24,14 @@
 
 import java.io.StringReader;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 /**
  * An immutable, random-access list of Address objects.
  */
-public class AddressList {
+public class AddressList implements Iterable<Address> {
 
     private List<? extends Address> addresses;
 
@@ -65,6 +67,15 @@
     }
 
     /**
+     * Returns an iterator over the addresses in this list.
+     *
+     * @return an iterator over the addresses in this list.
+     */
+    public Iterator<Address> iterator() {
+        return Collections.unmodifiableList(addresses).iterator();
+    }
+
+    /**
      * Returns a flat list of all mailboxes represented in this address list.
      * Use this if you don't care about grouping.
      */

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java?rev=732056&r1=732055&r2=732056&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/DomainList.java
Tue Jan  6 10:58:27 2009
@@ -20,13 +20,15 @@
 package org.apache.james.mime4j.field.address;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 /**
  * An immutable, random-access list of Strings (that are supposedly domain names
  * or domain literals).
  */
-public class DomainList {
+public class DomainList implements Iterable<String> {
     private List<String> domains;
 
     /**
@@ -63,6 +65,15 @@
     }
 
     /**
+     * Returns an iterator over the domains in this list.
+     *
+     * @return an iterator over the domains in this list.
+     */
+    public Iterator<String> iterator() {
+        return Collections.unmodifiableList(domains).iterator();
+    }
+    
+    /**
      * Returns the list of domains formatted as a route string (not including
      * the trailing ':').
      */

Modified: james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java?rev=732056&r1=732055&r2=732056&view=diff
==============================================================================
--- james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
(original)
+++ james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address/MailboxList.java
Tue Jan  6 10:58:27 2009
@@ -20,12 +20,14 @@
 package org.apache.james.mime4j.field.address;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 /**
  * An immutable, random-access list of Mailbox objects.
  */
-public class MailboxList {
+public class MailboxList implements Iterable<Mailbox> {
 
     private List<Mailbox> mailboxes;
 
@@ -61,6 +63,15 @@
     }
 
     /**
+     * Returns an iterator over the mailboxes in this list.
+     *
+     * @return an iterator over the mailboxes in this list.
+     */
+    public Iterator<Mailbox> iterator() {
+        return Collections.unmodifiableList(mailboxes).iterator();
+    }
+
+    /**
      * Dumps a representation of this mailbox list to stdout, for debugging
      * purposes.
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message