Class XmlSimpleList

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

    public class XmlSimpleList
    extends java.lang.Object
    implements java.util.List, java.io.Serializable
    The immutable List returned for XML simple list values. XmlSimpleList implements an equals() and hashCode() that compare list contents, so two XmlSimpleLists are the same if they have the same values in the same order.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlSimpleList​(java.util.List list)
      Constructs an immutable XmlSimpleList that wraps (does not copy) the given List.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Object element)
      Unsupported because this list is immutable.
      boolean add​(java.lang.Object o)
      Unsupported because this list is immutable.
      boolean addAll​(int index, java.util.Collection c)
      Unsupported because this list is immutable.
      boolean addAll​(java.util.Collection coll)
      Unsupported because this list is immutable.
      void clear()
      Unsupported because this list is immutable.
      boolean contains​(java.lang.Object o)
      True if the list is contains an object equal to o.
      boolean containsAll​(java.util.Collection coll)
      True if the list is contains all the objects in the given collection.
      boolean equals​(java.lang.Object o)
      Two XmlSimpleLists are equal if all their items are equal.
      java.lang.Object get​(int index)
      Returns the object at the specified position in this list.
      int hashCode()
      Combines the hash codes of all the list items.
      int indexOf​(java.lang.Object o)
      Returns index of the first occurance of an object equal to o.
      boolean isEmpty()
      True if the list is empty.
      java.util.Iterator iterator()
      Returns an iterator over the elements in this list in proper sequence.
      int lastIndexOf​(java.lang.Object o)
      Returns index of the last occurance of an object equal to o.
      java.util.ListIterator listIterator()
      Returns a list iterator of the elements in this list in proper sequence.
      java.util.ListIterator listIterator​(int index)
      Returns a list iterator of the elements in this list in proper sequence, starting at the specified position in this list.
      java.lang.Object remove​(int index)
      Unsupported because this list is immutable.
      boolean remove​(java.lang.Object o)
      Unsupported because this list is immutable.
      boolean removeAll​(java.util.Collection coll)
      Unsupported because this list is immutable.
      boolean retainAll​(java.util.Collection coll)
      Unsupported because this list is immutable.
      java.lang.Object set​(int index, java.lang.Object element)
      Unsupported because this list is immutable.
      int size()
      Returns the number of elements in this list.
      java.util.List subList​(int from, int to)
      Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
      java.lang.Object[] toArray()
      Copies the collection to an array.
      java.lang.Object[] toArray​(java.lang.Object[] a)
      Copies the collection to an array of a specified type.
      java.lang.String toString()
      Returns a space-separated list of the string representations of all the items in the list.
      • Methods inherited from class java.lang.Object

        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

        replaceAll, sort, spliterator
    • Constructor Detail

      • XmlSimpleList

        public XmlSimpleList​(java.util.List list)
        Constructs an immutable XmlSimpleList that wraps (does not copy) the given List. All non-mutating methods delegate to the underlying List instance.
    • Method Detail

      • size

        public int size()
        Returns the number of elements in this list.
        Specified by:
        size in interface java.util.Collection
        Specified by:
        size in interface java.util.List
      • isEmpty

        public boolean isEmpty()
        True if the list is empty.
        Specified by:
        isEmpty in interface java.util.Collection
        Specified by:
        isEmpty in interface java.util.List
      • contains

        public boolean contains​(java.lang.Object o)
        True if the list is contains an object equal to o.
        Specified by:
        contains in interface java.util.Collection
        Specified by:
        contains in interface java.util.List
      • containsAll

        public boolean containsAll​(java.util.Collection coll)
        True if the list is contains all the objects in the given collection.
        Specified by:
        containsAll in interface java.util.Collection
        Specified by:
        containsAll in interface java.util.List
      • toArray

        public java.lang.Object[] toArray()
        Copies the collection to an array.
        Specified by:
        toArray in interface java.util.Collection
        Specified by:
        toArray in interface java.util.List
      • toArray

        public java.lang.Object[] toArray​(java.lang.Object[] a)
        Copies the collection to an array of a specified type.
        Specified by:
        toArray in interface java.util.Collection
        Specified by:
        toArray in interface java.util.List
      • add

        public boolean add​(java.lang.Object o)
        Unsupported because this list is immutable.
        Specified by:
        add in interface java.util.Collection
        Specified by:
        add in interface java.util.List
      • addAll

        public boolean addAll​(java.util.Collection coll)
        Unsupported because this list is immutable.
        Specified by:
        addAll in interface java.util.Collection
        Specified by:
        addAll in interface java.util.List
      • remove

        public boolean remove​(java.lang.Object o)
        Unsupported because this list is immutable.
        Specified by:
        remove in interface java.util.Collection
        Specified by:
        remove in interface java.util.List
      • removeAll

        public boolean removeAll​(java.util.Collection coll)
        Unsupported because this list is immutable.
        Specified by:
        removeAll in interface java.util.Collection
        Specified by:
        removeAll in interface java.util.List
      • retainAll

        public boolean retainAll​(java.util.Collection coll)
        Unsupported because this list is immutable.
        Specified by:
        retainAll in interface java.util.Collection
        Specified by:
        retainAll in interface java.util.List
      • clear

        public void clear()
        Unsupported because this list is immutable.
        Specified by:
        clear in interface java.util.Collection
        Specified by:
        clear in interface java.util.List
      • get

        public java.lang.Object get​(int index)
        Returns the object at the specified position in this list.
        Specified by:
        get in interface java.util.List
      • set

        public java.lang.Object set​(int index,
                                    java.lang.Object element)
        Unsupported because this list is immutable.
        Specified by:
        set in interface java.util.List
      • add

        public void add​(int index,
                        java.lang.Object element)
        Unsupported because this list is immutable.
        Specified by:
        add in interface java.util.List
      • remove

        public java.lang.Object remove​(int index)
        Unsupported because this list is immutable.
        Specified by:
        remove in interface java.util.List
      • indexOf

        public int indexOf​(java.lang.Object o)
        Returns index of the first occurance of an object equal to o.
        Specified by:
        indexOf in interface java.util.List
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Returns index of the last occurance of an object equal to o.
        Specified by:
        lastIndexOf in interface java.util.List
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection c)
        Unsupported because this list is immutable.
        Specified by:
        addAll in interface java.util.List
      • subList

        public java.util.List subList​(int from,
                                      int to)
        Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
        Specified by:
        subList in interface java.util.List
      • iterator

        public java.util.Iterator iterator()
        Returns an iterator over the elements in this list in proper sequence.
        Specified by:
        iterator in interface java.util.Collection
        Specified by:
        iterator in interface java.lang.Iterable
        Specified by:
        iterator in interface java.util.List
      • listIterator

        public java.util.ListIterator listIterator()
        Returns a list iterator of the elements in this list in proper sequence.
        Specified by:
        listIterator in interface java.util.List
      • listIterator

        public java.util.ListIterator listIterator​(int index)
        Returns a list iterator of the elements in this list in proper sequence, starting at the specified position in this list.
        Specified by:
        listIterator in interface java.util.List
      • toString

        public java.lang.String toString()
        Returns a space-separated list of the string representations of all the items in the list. For most lists, this is a valid xml lexical value for the list. (The notable exception is a list of QNames.)
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Two XmlSimpleLists are equal if all their items are equal. (They must have the same number of items, and the items must be in the same order.)
        Specified by:
        equals in interface java.util.Collection
        Specified by:
        equals in interface java.util.List
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Combines the hash codes of all the list items.
        Specified by:
        hashCode in interface java.util.Collection
        Specified by:
        hashCode in interface java.util.List
        Overrides:
        hashCode in class java.lang.Object