Package: groovy.lang

## [Java] Class Sequence

- groovy.lang.Sequence

- All Implemented Interfaces and Traits:
    GroovyObject

      public class Sequence
      extends ArrayList
      implements GroovyObject

  Represents a sequence of zero or more objects of a given type. The type can be omitted in which case any type of object can be added.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `Sequence()` Creates a sequence with no type restriction.
    `Sequence(Class type)` Creates a sequence constrained to the supplied type.
    `Sequence(Class type, List content)` Creates a sequence initialized with the supplied content.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `add(int index, Object element)` Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: IndexOutOfBoundsException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: UnsupportedOperationException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: ClassCastException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: NullPointerException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: IllegalArgumentException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: IndexOutOfBoundsException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). throws: UnsupportedOperationException if the `add` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) Parameters: `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted `index` - index at which the specified element is to be inserted `element` - element to be inserted Implementation Requirements: This implementation always throws an `UnsupportedOperationException`.
    `` | `public boolean` | `add(Object element)` Appends the specified element to the end of this list. Parameters: `e` - element to be appended to this list Returns: `true` (as specified by Collection.add)
    `` | `public boolean` | `addAll(Collection c)` Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.) throws: NullPointerException if the specified collection is null Parameters: `c` - collection containing elements to be added to this list Returns: `true` if this list changed as a result of the call
    `` | `public boolean` | `addAll(int index, Collection c)` Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator. throws: IndexOutOfBoundsException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: UnsupportedOperationException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: ClassCastException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: NullPointerException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: IllegalArgumentException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: IndexOutOfBoundsException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) throws: UnsupportedOperationException if the `addAll` operation is not supported by this list throws: ClassCastException if the class of an element of the specified collection prevents it from being added to this list throws: NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null throws: IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`) throws: NullPointerException if the specified collection is null Parameters: `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list `index` - index at which to insert the first element from the specified collection `c` - collection containing elements to be added to this list Returns: `true` if this list changed as a result of the call `true` if this list changed as a result of the call `true` if this list changed as a result of the call `true` if this list changed as a result of the call `true` if this list changed as a result of the call `true` if this list changed as a result of the call `true` if this list changed as a result of the call Implementation Requirements: This implementation gets an iterator over the specified collection and iterates over it, inserting the elements obtained from the iterator into this list at the appropriate position, one at a time, using `add(int, E)`. Many implementations will override this method for efficiency. Note that this implementation throws an `UnsupportedOperationException` unless add(int, Object) add(int, E) is overridden.
    `` | `protected void` | `checkCollectionType(Collection c)` Checks that each member of the given collection are of the correct type
    `` | `protected void` | `checkType(Object object)` Checks that the given object instance is of the correct type otherwise a runtime exception is thrown
    `` | `public void` | `clear()` Removes all of the elements from this list. The list will be empty after this call returns.
    `` | `public boolean` | `equals(Object that)` Compares the specified object with this list for equality. Returns `true` if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements `e1` and `e2` are equal if `(e1==null ? e2==null : e1.equals(e2))`.) In other words, two lists are defined to be equal if they contain the same elements in the same order. Implementation Requirements: This implementation first checks if the specified object is this list. If so, it returns `true`; if not, it checks if the specified object is a list. If not, it returns `false`; if so, it iterates over both lists, comparing corresponding pairs of elements. If any comparison returns `false`, this method returns `false`. If either iterator runs out of elements before the other it returns `false` (as the lists are of unequal length); otherwise it returns `true` when the iterations complete. Parameters: `o` - the object to be compared for equality with this list Returns: `true` if the specified object is equal to this list
    `` | `public boolean` | `equals(Sequence that)` Compares this sequence with another sequence using Groovy equality.
    `` | `public MetaClass` | `getMetaClass()` * Returns the metaclass for a given class. * * Returns: the metaClass of this instance
    `` | `public Object` | `getProperty(String property)` * Retrieves a property value. * * Parameters: `propertyName` - the name of the property of interest * Returns: the given property
    `` | `public int` | `hashCode()` Returns the hash code value for this list. Implementation Requirements: This implementation uses exactly the code that is used to define the list hash function in the documentation for the List.hashCode method. Returns: the hash code value for this list
    `` | `public Object` | `invokeMethod(String name, Object args)` * Invokes the given method. * * Parameters: `name` - the name of the method to call * `args` - the arguments to use for the method call * Returns: the result of invoking the method
    `` | `public int` | `minimumSize()` Returns the minimum allowed size for this sequence.
    `` | `public Object` | `remove(int index)` Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). throws: IndexOutOfBoundsException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. throws: UnsupportedOperationException if the `remove` operation is not supported by this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: UnsupportedOperationException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. throws: UnsupportedOperationException if the `remove` operation is not supported by this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: IndexOutOfBoundsException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. throws: UnsupportedOperationException if the `remove` operation is not supported by this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) Parameters: `index` - the index of the element to be removed `index` - the index of the element to be removed `index` - the index of the element to be removed `index` - the index of the element to be removed Returns: the element that was removed from the list the element previously at the specified position the element previously at the specified position the element previously at the specified position Implementation Requirements: This implementation always throws an `UnsupportedOperationException`.
    `` | `protected void` | `removeRange(int fromIndex, int toIndex)` Removes from this list all of the elements whose index is between `fromIndex`, inclusive, and `toIndex`, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by `(toIndex - fromIndex)` elements. (If `toIndex==fromIndex`, this operation has no effect.) throws: IndexOutOfBoundsException if `fromIndex` or `toIndex` is out of range (`fromIndex < 0 || toIndex > size() || toIndex < fromIndex`)
    `` | `public void` | `set(Collection collection)` Sets the contents of this sequence to that of the given collection.
    `` | `public Object` | `set(int index, Object element)` Replaces the element at the specified position in this list with the specified element. throws: IndexOutOfBoundsException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: UnsupportedOperationException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: ClassCastException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: NullPointerException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: IllegalArgumentException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) throws: IndexOutOfBoundsException Replaces the element at the specified position in this list with the specified element (optional operation). throws: UnsupportedOperationException if the `set` operation is not supported by this list throws: ClassCastException if the class of the specified element prevents it from being added to this list throws: NullPointerException if the specified element is null and this list does not permit null elements throws: IllegalArgumentException if some property of the specified element prevents it from being added to this list throws: IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`) Parameters: `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position `index` - index of the element to replace `element` - element to be stored at the specified position Returns: the element previously at the specified position the element previously at the specified position the element previously at the specified position the element previously at the specified position the element previously at the specified position the element previously at the specified position the element previously at the specified position Implementation Requirements: This implementation always throws an `UnsupportedOperationException`.
    `` | `public void` | `setMetaClass(MetaClass metaClass)` * Allows the MetaClass to be replaced with a derived implementation. * * Parameters: `metaClass` - the new metaclass
    `` | `public void` | `setProperty(String property, Object newValue)` * Sets the given property to the new value. * * Parameters: `propertyName` - the name of the property of interest * `newValue` - the new value for the property
    `` | `public Class` | `type()` Returns: the type of the elements in the sequence or null if there is no type constraint on this sequence

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ArrayList` | `add, add, addAll, addAll, clear, clone, contains, containsAll, ensureCapacity, equals, forEach, get, getClass, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, notify, notifyAll, parallelStream, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, stream, subList, toArray, toArray, toArray, toString, trimToSize, wait, wait, wait`

- - ### Constructor Detail

    - #### public Sequence()

      Creates a sequence with no type restriction.

    - #### public Sequence(Class type)

      Creates a sequence constrained to the supplied type.

      Parameters:
        `type` - the allowed element type

    - #### public Sequence(Class type, List content)

      Creates a sequence initialized with the supplied content.

      Parameters:
        `type` - the allowed element type
        `content` - the initial content

  - ### Method Detail

    - #### public void add(int index, Object element)

      Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

      throws:
        IndexOutOfBoundsException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        UnsupportedOperationException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        ClassCastException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        NullPointerException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        IllegalArgumentException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        IndexOutOfBoundsException Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      throws:
        UnsupportedOperationException if the `add` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      Parameters:
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
        `index` - index at which the specified element is to be inserted
        `element` - element to be inserted
      Implementation Requirements:
        This implementation always throws an `UnsupportedOperationException`.

    - #### public boolean add(Object element)

      Appends the specified element to the end of this list.

      Parameters:
        `e` - element to be appended to this list
      Returns:
        `true` (as specified by Collection.add)

    - #### public boolean addAll(Collection c)

      Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)

      throws:
        NullPointerException if the specified collection is null
      Parameters:
        `c` - collection containing elements to be added to this list
      Returns:
        `true` if this list changed as a result of the call

    - #### public boolean addAll(int index, Collection c)

      Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

      throws:
        IndexOutOfBoundsException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        UnsupportedOperationException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        ClassCastException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        NullPointerException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        IllegalArgumentException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        IndexOutOfBoundsException Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
      throws:
        UnsupportedOperationException if the `addAll` operation is not supported by this list
      throws:
        ClassCastException if the class of an element of the specified collection prevents it from being added to this list
      throws:
        NullPointerException if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
      throws:
        IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index > size()`)
      throws:
        NullPointerException if the specified collection is null
      Parameters:
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
        `index` - index at which to insert the first element from the specified collection
        `c` - collection containing elements to be added to this list
      Returns:
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
        `true` if this list changed as a result of the call
      Implementation Requirements:
        This implementation gets an iterator over the specified collection and iterates over it, inserting the elements obtained from the iterator into this list at the appropriate position, one at a time, using `add(int, E)`. Many implementations will override this method for efficiency.

        Note that this implementation throws an `UnsupportedOperationException` unless add(int, Object) add(int, E) is overridden.

    - #### protected void checkCollectionType(Collection c)

      Checks that each member of the given collection are of the correct type

    - #### protected void checkType(Object object)

      Checks that the given object instance is of the correct type otherwise a runtime exception is thrown

    - #### public void clear()

      Removes all of the elements from this list. The list will be empty after this call returns.

    - #### public boolean equals(Object that)

      Compares the specified object with this list for equality. Returns `true` if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements `e1` and `e2` are equal if `(e1==null ? e2==null : e1.equals(e2))`.) In other words, two lists are defined to be equal if they contain the same elements in the same order.

      Implementation Requirements:
        This implementation first checks if the specified object is this list. If so, it returns `true`; if not, it checks if the specified object is a list. If not, it returns `false`; if so, it iterates over both lists, comparing corresponding pairs of elements. If any comparison returns `false`, this method returns `false`. If either iterator runs out of elements before the other it returns `false` (as the lists are of unequal length); otherwise it returns `true` when the iterations complete.
      Parameters:
        `o` - the object to be compared for equality with this list
      Returns:
        `true` if the specified object is equal to this list

    - #### public boolean equals(Sequence that)

      Compares this sequence with another sequence using Groovy equality.

      Parameters:
        `that` - the other sequence
      Returns:
        `true` if the sequences are equal

    - #### public MetaClass getMetaClass()

      * Returns the metaclass for a given class. * *

      Returns:
        the metaClass of this instance

    - #### public Object getProperty(String property)

      * Retrieves a property value. * *

      Parameters:
        `propertyName` - the name of the property of interest *
      Returns:
        the given property

    - #### public int hashCode()

      Returns the hash code value for this list.

      Implementation Requirements:
        This implementation uses exactly the code that is used to define the list hash function in the documentation for the List.hashCode method.
      Returns:
        the hash code value for this list

    - #### public Object invokeMethod(String name, Object args)

      * Invokes the given method. * *

      Parameters:
        `name` - the name of the method to call *
        `args` - the arguments to use for the method call *
      Returns:
        the result of invoking the method

    - #### public int minimumSize()

      Returns the minimum allowed size for this sequence.

      Returns:
        the minimum size

    - #### public Object remove(int index)

      Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

      throws:
        IndexOutOfBoundsException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
      throws:
        UnsupportedOperationException if the `remove` operation is not supported by this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        UnsupportedOperationException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
      throws:
        UnsupportedOperationException if the `remove` operation is not supported by this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        IndexOutOfBoundsException Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
      throws:
        UnsupportedOperationException if the `remove` operation is not supported by this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      Parameters:
        `index` - the index of the element to be removed
        `index` - the index of the element to be removed
        `index` - the index of the element to be removed
        `index` - the index of the element to be removed
      Returns:
        the element that was removed from the list
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
      Implementation Requirements:
        This implementation always throws an `UnsupportedOperationException`.

    - #### protected void removeRange(int fromIndex, int toIndex)

      Removes from this list all of the elements whose index is between `fromIndex`, inclusive, and `toIndex`, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by `(toIndex - fromIndex)` elements. (If `toIndex==fromIndex`, this operation has no effect.)

      throws:
        IndexOutOfBoundsException if `fromIndex` or `toIndex` is out of range (`fromIndex < 0 || toIndex > size() || toIndex < fromIndex`)

    - #### public void set(Collection collection)

      Sets the contents of this sequence to that of the given collection.

    - #### public Object set(int index, Object element)

      Replaces the element at the specified position in this list with the specified element.

      throws:
        IndexOutOfBoundsException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        UnsupportedOperationException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        ClassCastException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        NullPointerException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        IllegalArgumentException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      throws:
        IndexOutOfBoundsException Replaces the element at the specified position in this list with the specified element (optional operation).
      throws:
        UnsupportedOperationException if the `set` operation is not supported by this list
      throws:
        ClassCastException if the class of the specified element prevents it from being added to this list
      throws:
        NullPointerException if the specified element is null and this list does not permit null elements
      throws:
        IllegalArgumentException if some property of the specified element prevents it from being added to this list
      throws:
        IndexOutOfBoundsException if the index is out of range (`index < 0 || index >= size()`)
      Parameters:
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
        `index` - index of the element to replace
        `element` - element to be stored at the specified position
      Returns:
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
        the element previously at the specified position
      Implementation Requirements:
        This implementation always throws an `UnsupportedOperationException`.

    - #### public void setMetaClass(MetaClass metaClass)

      * Allows the MetaClass to be replaced with a derived implementation. * *

      Parameters:
        `metaClass` - the new metaclass

    - #### public void setProperty(String property, Object newValue)

      * Sets the given property to the new value. * *

      Parameters:
        `propertyName` - the name of the property of interest *
        `newValue` - the new value for the property

    - #### public Class type()

      Returns:
        the type of the elements in the sequence or null if there is no type constraint on this sequence