org.apache.xmlbeans

## Class XmlSimpleList<T>

- java.lang.Object
- - org.apache.xmlbeans.XmlSimpleList<T>

- All Implemented Interfaces:
    Serializable, Iterable<T>, Collection<T>, List<T>

      public class XmlSimpleList<T>
      extends Object
      implements List<T>, 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 and Description
    `XmlSimpleList(List<T> 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 and Description
    --- | ---
    `void` | `add(int index, Object element)` Unsupported because this list is immutable.
    `boolean` | `add(Object o)` Unsupported because this list is immutable.
    `boolean` | `addAll(Collection coll)` Unsupported because this list is immutable.
    `boolean` | `addAll(int index, Collection c)` Unsupported because this list is immutable.
    `void` | `clear()` Unsupported because this list is immutable.
    `boolean` | `contains(Object o)` True if the list is contains an object equal to o.
    `boolean` | `containsAll(Collection coll)` True if the list is contains all the objects in the given collection.
    `boolean` | `equals(Object o)` Two XmlSimpleLists are equal if all their items are equal.
    `T` | `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(Object o)` Returns index of the first occurance of an object equal to o.
    `boolean` | `isEmpty()` True if the list is empty.
    `Iterator<T>` | `iterator()` Returns an iterator over the elements in this list in proper sequence.
    `int` | `lastIndexOf(Object o)` Returns index of the last occurance of an object equal to o.
    `ListIterator<T>` | `listIterator()` Returns a list iterator of the elements in this list in proper sequence.
    `ListIterator<T>` | `listIterator(int index)` Returns a list iterator of the elements in this list in proper sequence, starting at the specified position in this list.
    `T` | `remove(int index)` Unsupported because this list is immutable.
    `boolean` | `remove(Object o)` Unsupported because this list is immutable.
    `boolean` | `removeAll(Collection coll)` Unsupported because this list is immutable.
    `boolean` | `retainAll(Collection coll)` Unsupported because this list is immutable.
    `T` | `set(int index, T element)` Unsupported because this list is immutable.
    `int` | `size()` Returns the number of elements in this list.
    `List<T>` | `subList(int from, int to)` Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
    `Object[]` | `toArray()` Copies the collection to an array.
    `<X> X[]` | `toArray(X[] a)` Copies the collection to an array of a specified type.
    `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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.List

      `replaceAll, sort, spliterator`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Constructor Detail

    - #### XmlSimpleList

          public XmlSimpleList(List<T> 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 `Collection<T>`
      Specified by:
        `size` in interface `List<T>`

    - #### isEmpty

          public boolean isEmpty()

      True if the list is empty.
      Specified by:
        `isEmpty` in interface `Collection<T>`
      Specified by:
        `isEmpty` in interface `List<T>`

    - #### contains

          public boolean contains(Object o)

      True if the list is contains an object equal to o.
      Specified by:
        `contains` in interface `Collection<T>`
      Specified by:
        `contains` in interface `List<T>`

    - #### containsAll

          public boolean containsAll(Collection coll)

      True if the list is contains all the objects in the given collection.
      Specified by:
        `containsAll` in interface `Collection<T>`
      Specified by:
        `containsAll` in interface `List<T>`

    - #### toArray

          public Object[] toArray()

      Copies the collection to an array.
      Specified by:
        `toArray` in interface `Collection<T>`
      Specified by:
        `toArray` in interface `List<T>`

    - #### toArray

          public <X> X[] toArray(X[] a)

      Copies the collection to an array of a specified type.
      Specified by:
        `toArray` in interface `Collection<T>`
      Specified by:
        `toArray` in interface `List<T>`

    - #### add

          public boolean add(Object o)

      Unsupported because this list is immutable.
      Specified by:
        `add` in interface `Collection<T>`
      Specified by:
        `add` in interface `List<T>`

    - #### addAll

          public boolean addAll(Collection coll)

      Unsupported because this list is immutable.
      Specified by:
        `addAll` in interface `Collection<T>`
      Specified by:
        `addAll` in interface `List<T>`

    - #### remove

          public boolean remove(Object o)

      Unsupported because this list is immutable.
      Specified by:
        `remove` in interface `Collection<T>`
      Specified by:
        `remove` in interface `List<T>`

    - #### removeAll

          public boolean removeAll(Collection coll)

      Unsupported because this list is immutable.
      Specified by:
        `removeAll` in interface `Collection<T>`
      Specified by:
        `removeAll` in interface `List<T>`

    - #### retainAll

          public boolean retainAll(Collection coll)

      Unsupported because this list is immutable.
      Specified by:
        `retainAll` in interface `Collection<T>`
      Specified by:
        `retainAll` in interface `List<T>`

    - #### clear

          public void clear()

      Unsupported because this list is immutable.
      Specified by:
        `clear` in interface `Collection<T>`
      Specified by:
        `clear` in interface `List<T>`

    - #### get

          public T get(int index)

      Returns the object at the specified position in this list.
      Specified by:
        `get` in interface `List<T>`

    - #### set

          public T set(int index,
                       T element)

      Unsupported because this list is immutable.
      Specified by:
        `set` in interface `List<T>`

    - #### add

          public void add(int index,
                          Object element)

      Unsupported because this list is immutable.
      Specified by:
        `add` in interface `List<T>`

    - #### remove

          public T remove(int index)

      Unsupported because this list is immutable.
      Specified by:
        `remove` in interface `List<T>`

    - #### indexOf

          public int indexOf(Object o)

      Returns index of the first occurance of an object equal to o.
      Specified by:
        `indexOf` in interface `List<T>`

    - #### lastIndexOf

          public int lastIndexOf(Object o)

      Returns index of the last occurance of an object equal to o.
      Specified by:
        `lastIndexOf` in interface `List<T>`

    - #### addAll

          public boolean addAll(int index,
                                Collection c)

      Unsupported because this list is immutable.
      Specified by:
        `addAll` in interface `List<T>`

    - #### subList

          public List<T> 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 `List<T>`

    - #### iterator

          public Iterator<T> iterator()

      Returns an iterator over the elements in this list in proper sequence.
      Specified by:
        `iterator` in interface `Iterable<T>`
      Specified by:
        `iterator` in interface `Collection<T>`
      Specified by:
        `iterator` in interface `List<T>`

    - #### listIterator

          public ListIterator<T> listIterator()

      Returns a list iterator of the elements in this list in proper sequence.
      Specified by:
        `listIterator` in interface `List<T>`

    - #### listIterator

          public ListIterator<T> 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 `List<T>`

    - #### toString

          public 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 `Object`

    - #### equals

          public boolean equals(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 `Collection<T>`
      Specified by:
        `equals` in interface `List<T>`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Combines the hash codes of all the list items.
      Specified by:
        `hashCode` in interface `Collection<T>`
      Specified by:
        `hashCode` in interface `List<T>`
      Overrides:
        `hashCode` in class `Object`