Class DomainList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<String>
-
- org.apache.james.mime4j.dom.address.DomainList
-
- All Implemented Interfaces:
Serializable
,Iterable<String>
,Collection<String>
,List<String>
public final class DomainList extends AbstractList<String> implements Serializable
An immutable, random-access list of Strings (that are supposedly domain names or domain literals).- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description DomainList(String... domains)
DomainList(List<String> domains)
DomainList(List<String> domains, boolean dontCopy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
get(int index)
Gets the domain name or domain literal at the specified index.int
size()
The number of elements in this list.String
toRouteString()
Returns the list of domains formatted as a route string (not including the trailing ':').String
toString()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Constructor Detail
-
DomainList
public DomainList(List<String> domains, boolean dontCopy)
- Parameters:
domains
- A List that contains only String objects.dontCopy
- true iff it is not possible for the addresses list to be modified by someone else.
-
DomainList
public DomainList(List<String> domains)
- Parameters:
domains
- A List that contains only String objects.
-
DomainList
public DomainList(String... domains)
- Parameters:
domains
- A List that contains only String objects.
-
-
Method Detail
-
size
public int size()
The number of elements in this list.- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceList<String>
- Specified by:
size
in classAbstractCollection<String>
-
get
public String get(int index)
Gets the domain name or domain literal at the specified index.- Specified by:
get
in interfaceList<String>
- Specified by:
get
in classAbstractList<String>
- Throws:
IndexOutOfBoundsException
- If index is < 0 or >= size().
-
toRouteString
public String toRouteString()
Returns the list of domains formatted as a route string (not including the trailing ':').
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection<String>
-
-