FileDocCategorySizeDatePackage
DomainList.javaAPI DocAndroid 1.5 API2668Wed May 06 22:42:46 BST 2009org.apache.james.mime4j.field.address

DomainList

public class DomainList extends Object
An immutable, random-access list of Strings (that are supposedly domain names or domain literals).

Fields Summary
private ArrayList
domains
Constructors Summary
public DomainList(ArrayList domains, boolean dontCopy)

param
domains An ArrayList that contains only String objects.
param
dontCopy true iff it is not possible for the domains ArrayList to be modified by someone else.

		if (domains != null)
			this.domains = (dontCopy ? domains : (ArrayList) domains.clone());
		else
			this.domains = new ArrayList(0);
	
Methods Summary
public java.lang.Stringget(int index)
Gets the domain name or domain literal at the specified index.

throws
IndexOutOfBoundsException If index is < 0 or >= size().

		if (0 > index || size() <= index)
			throw new IndexOutOfBoundsException();
		return (String) domains.get(index);
	
public intsize()
The number of elements in this list.

		return domains.size();
	
public java.lang.StringtoRouteString()
Returns the list of domains formatted as a route string (not including the trailing ':').

		StringBuffer out = new StringBuffer();
		for (int i = 0; i < domains.size(); i++) {
			out.append("@");
			out.append(get(i));
			if (i + 1 < domains.size())
				out.append(",");
		}
		return out.toString();