james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwiederk...@apache.org
Subject svn commit: r737440 - in /james/mime4j/trunk/src/main/java/org/apache/james/mime4j/field/address: AddressList.java DomainList.java MailboxList.java
Date Sat, 24 Jan 2009 21:31:23 GMT
Author: mwiederkehr
Date: Sat Jan 24 21:31:22 2009
New Revision: 737440

URL: http://svn.apache.org/viewvc?rev=737440&view=rev
Log:
MIME4J-107: AddressList, DomainList and MailboxList extend java.util.AbstractList

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=737440&r1=737439&r2=737440&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
Sat Jan 24 21:31:22 2009
@@ -24,15 +24,15 @@
 
 import java.io.Serializable;
 import java.io.StringReader;
+import java.util.AbstractList;
 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 implements Iterable<Address>, Serializable {
+public class AddressList extends AbstractList<Address> implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -56,6 +56,7 @@
     /**
      * The number of elements in this list.
      */
+    @Override
     public int size() {
         return addresses.size();
     }
@@ -63,22 +64,12 @@
     /**
      * Gets an address.
      */
+    @Override
     public Address get(int index) {
-        if (0 > index || size() <= index)
-            throw new IndexOutOfBoundsException();
         return addresses.get(index);
     }
 
     /**
-     * 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=737440&r1=737439&r2=737440&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
Sat Jan 24 21:31:22 2009
@@ -20,16 +20,16 @@
 package org.apache.james.mime4j.field.address;
 
 import java.io.Serializable;
+import java.util.AbstractList;
 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 implements Iterable<String>, Serializable {
+public class DomainList extends AbstractList<String> implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -52,6 +52,7 @@
     /**
      * The number of elements in this list.
      */
+    @Override
     public int size() {
         return domains.size();
     }
@@ -62,22 +63,12 @@
      * @throws IndexOutOfBoundsException
      *             If index is &lt; 0 or &gt;= size().
      */
+    @Override
     public String get(int index) {
-        if (0 > index || size() <= index)
-            throw new IndexOutOfBoundsException();
         return domains.get(index);
     }
 
     /**
-     * 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=737440&r1=737439&r2=737440&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
Sat Jan 24 21:31:22 2009
@@ -20,15 +20,15 @@
 package org.apache.james.mime4j.field.address;
 
 import java.io.Serializable;
+import java.util.AbstractList;
 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 implements Iterable<Mailbox>, Serializable {
+public class MailboxList extends AbstractList<Mailbox> implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -52,6 +52,7 @@
     /**
      * The number of elements in this list.
      */
+    @Override
     public int size() {
         return mailboxes.size();
     }
@@ -59,22 +60,12 @@
     /**
      * Gets an address.
      */
+    @Override
     public Mailbox get(int index) {
-        if (0 > index || size() <= index)
-            throw new IndexOutOfBoundsException();
         return mailboxes.get(index);
     }
 
     /**
-     * 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