Class AddressList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<Address>, java.util.Collection<Address>, java.util.List<Address>

    public class AddressList
    extends java.util.AbstractList<Address>
    implements java.io.Serializable
    An immutable, random-access list of Address objects.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<? extends Address> addresses  
      private static long serialVersionUID  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MailboxList flatten()
      Returns a flat list of all mailboxes represented in this address list.
      Address get​(int index)
      Gets an address.
      int size()
      The number of elements in this list.
      • 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, toString
      • 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.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Field Detail

      • addresses

        private final java.util.List<? extends Address> addresses
    • Constructor Detail

      • AddressList

        public AddressList​(java.util.List<? extends Address> addresses,
                           boolean dontCopy)
        Parameters:
        addresses - A List that contains only Address objects.
        dontCopy - true iff it is not possible for the addresses list to be modified by someone else.
      • AddressList

        public AddressList​(java.util.List<? extends Address> addresses)
        Parameters:
        addresses - A List that contains only Address objects.
      • AddressList

        public AddressList​(Address... addresses)
        Parameters:
        addresses - A List that contains only Address objects.
    • Method Detail

      • size

        public int size()
        The number of elements in this list.
        Specified by:
        size in interface java.util.Collection<Address>
        Specified by:
        size in interface java.util.List<Address>
        Specified by:
        size in class java.util.AbstractCollection<Address>
      • get

        public Address get​(int index)
        Gets an address.
        Specified by:
        get in interface java.util.List<Address>
        Specified by:
        get in class java.util.AbstractList<Address>
      • flatten

        public MailboxList flatten()
        Returns a flat list of all mailboxes represented in this address list. Use this if you don't care about grouping.