Package: org.codehaus.groovy.grails.web.binding

## [Java] Class ListOrderedSet

- org.codehaus.groovy.grails.web.binding.ListOrderedSet

- All Implemented Interfaces and Traits:
    java.util.List

      @java.lang.SuppressWarnings({"rawtypes", "unchecked"})
      @java.lang.Deprecated
      public class ListOrderedSet
      extends org.apache.commons.collections.set.AbstractSerializableSetDecorator

  Forked from Apache Commons Collections' implementation of ListOrderedSet. This one actually implements the List interface. Yes we are away of the warnings in the javadoc about problems with incompatibilities between the List and Set interfaces, however this class is designed to used internally only for data binding and not by end users.

  deprecated:
    Used by old Spring binder which has been replaced
  Authors:
    Stephen Colebourne
    Henning P. Schmiedehausen
    Graeme Rocher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected java.util.List` | `setOrder` | Internal list to hold the sequence of objects

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ListOrderedSet ()` Constructs a new empty ListOrderedSet using a HashSet and an ArrayList internally.
    `protected ListOrderedSet (java.util.Set set)` Constructor that wraps (not copies).
    `protected ListOrderedSet (java.util.Set set, java.util.List list)` Constructor that wraps (not copies) the Set and specifies the list to use.

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `boolean` | `add(java.lang.Object object)`
    `void` | `add(int index, java.lang.Object object)`
    `boolean` | `addAll(java.util.Collection coll)`
    `boolean` | `addAll(int index, java.util.Collection coll)`
    `java.util.List` | `asList()` Gets an unmodifiable view of the order of the Set.
    `void` | `clear()`
    `static ListOrderedSet` | `decorate(java.util.Set set)` Factory method to create an ordered set.
    `static ListOrderedSet` | `decorate(java.util.List list)` Factory method to create an ordered set using the supplied list to retain order.
    `java.lang.Object` | `get(int index)`
    `int` | `indexOf(java.lang.Object object)`
    `java.util.Iterator` | `iterator()`
    `int` | `lastIndexOf(java.lang.Object o)`
    `java.util.ListIterator` | `listIterator()`
    `java.util.ListIterator` | `listIterator(int index)`
    `boolean` | `remove(java.lang.Object object)`
    `java.lang.Object` | `remove(int index)`
    `boolean` | `removeAll(java.util.Collection coll)`
    `boolean` | `retainAll(java.util.Collection coll)`
    `java.lang.Object` | `set(int index, java.lang.Object element)`
    `java.util.List` | `subList(int fromIndex, int toIndex)`
    `java.lang.Object[]` | `toArray()`
    `java.lang.Object[]` | `toArray(java.lang.Object[] a)`
    `java.lang.String` | `toString()` Uses the underlying List's toString so that order is achieved.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class org.apache.commons.collections.set.AbstractSerializableSetDecorator` | `org.apache.commons.collections.set.AbstractSerializableSetDecorator#add(java.lang.Object), org.apache.commons.collections.set.AbstractSerializableSetDecorator#remove(java.lang.Object), org.apache.commons.collections.set.AbstractSerializableSetDecorator#equals(java.lang.Object), org.apache.commons.collections.set.AbstractSerializableSetDecorator#toString(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#hashCode(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#clear(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#isEmpty(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#contains(java.lang.Object), org.apache.commons.collections.set.AbstractSerializableSetDecorator#size(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#toArray([Ljava.lang.Object;), org.apache.commons.collections.set.AbstractSerializableSetDecorator#toArray(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#addAll(java.util.Collection), org.apache.commons.collections.set.AbstractSerializableSetDecorator#iterator(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#containsAll(java.util.Collection), org.apache.commons.collections.set.AbstractSerializableSetDecorator#removeAll(java.util.Collection), org.apache.commons.collections.set.AbstractSerializableSetDecorator#retainAll(java.util.Collection), org.apache.commons.collections.set.AbstractSerializableSetDecorator#wait(long, int), org.apache.commons.collections.set.AbstractSerializableSetDecorator#wait(long), org.apache.commons.collections.set.AbstractSerializableSetDecorator#wait(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#getClass(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#notify(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#notifyAll()`
    `class org.apache.commons.collections.set.AbstractSetDecorator` | `org.apache.commons.collections.set.AbstractSetDecorator#add(java.lang.Object), org.apache.commons.collections.set.AbstractSetDecorator#remove(java.lang.Object), org.apache.commons.collections.set.AbstractSetDecorator#equals(java.lang.Object), org.apache.commons.collections.set.AbstractSetDecorator#toString(), org.apache.commons.collections.set.AbstractSetDecorator#hashCode(), org.apache.commons.collections.set.AbstractSetDecorator#clear(), org.apache.commons.collections.set.AbstractSetDecorator#isEmpty(), org.apache.commons.collections.set.AbstractSetDecorator#contains(java.lang.Object), org.apache.commons.collections.set.AbstractSetDecorator#size(), org.apache.commons.collections.set.AbstractSetDecorator#toArray([Ljava.lang.Object;), org.apache.commons.collections.set.AbstractSetDecorator#toArray(), org.apache.commons.collections.set.AbstractSetDecorator#addAll(java.util.Collection), org.apache.commons.collections.set.AbstractSetDecorator#iterator(), org.apache.commons.collections.set.AbstractSetDecorator#containsAll(java.util.Collection), org.apache.commons.collections.set.AbstractSetDecorator#removeAll(java.util.Collection), org.apache.commons.collections.set.AbstractSetDecorator#retainAll(java.util.Collection), org.apache.commons.collections.set.AbstractSetDecorator#wait(long, int), org.apache.commons.collections.set.AbstractSetDecorator#wait(long), org.apache.commons.collections.set.AbstractSetDecorator#wait(), org.apache.commons.collections.set.AbstractSetDecorator#getClass(), org.apache.commons.collections.set.AbstractSetDecorator#notify(), org.apache.commons.collections.set.AbstractSetDecorator#notifyAll()`

- - ### Field Detail

    - #### protected final java.util.List setOrder

      Internal list to hold the sequence of objects

  - ### Constructor Detail

    - #### public ListOrderedSet()

      Constructs a new empty ListOrderedSet using a HashSet and an ArrayList internally.

      Since:
        Commons Collections 3.1

    - #### protected ListOrderedSet(java.util.Set set)

      Constructor that wraps (not copies).

      throws:
        IllegalArgumentException if set is null
      Parameters:
        `set` - the set to decorate, must not be null

    - #### protected ListOrderedSet(java.util.Set set, java.util.List list)

      Constructor that wraps (not copies) the Set and specifies the list to use. The set and list must both be correctly initialised to the same elements.

      throws:
        IllegalArgumentException if set or list is null
      Parameters:
        `set` - the set to decorate, must not be null
        `list` - the list to decorate, must not be null

  - ### Method Detail

    - #### @java.lang.Override public boolean add(java.lang.Object object)

    - #### public void add(int index, java.lang.Object object)

    - #### @java.lang.Override public boolean addAll(java.util.Collection coll)

    - #### public boolean addAll(int index, java.util.Collection coll)

    - #### public java.util.List asList()

      Gets an unmodifiable view of the order of the Set.

      Returns:
        an unmodifiable list view

    - #### @java.lang.Override public void clear()

    - #### public static ListOrderedSet decorate(java.util.Set set)

      Factory method to create an ordered set. An ArrayList is used to retain order.

      throws:
        IllegalArgumentException if set is null
      Parameters:
        `set` - the set to decorate, must not be null

    - #### public static ListOrderedSet decorate(java.util.List list)

      Factory method to create an ordered set using the supplied list to retain order. A HashSet is used for the set behaviour.

      throws:
        IllegalArgumentException if list is null
      Parameters:
        `list` - the list to decorate, must not be null

    - #### public java.lang.Object get(int index)

    - #### public int indexOf(java.lang.Object object)

    - #### @java.lang.Override public java.util.Iterator iterator()

    - #### public int lastIndexOf(java.lang.Object o)

    - #### public java.util.ListIterator listIterator()

    - #### public java.util.ListIterator listIterator(int index)

    - #### @java.lang.Override public boolean remove(java.lang.Object object)

    - #### public java.lang.Object remove(int index)

    - #### @java.lang.Override public boolean removeAll(java.util.Collection coll)

    - #### @java.lang.Override public boolean retainAll(java.util.Collection coll)

    - #### public java.lang.Object set(int index, java.lang.Object element)

    - #### public java.util.List subList(int fromIndex, int toIndex)

    - #### @java.lang.Override public java.lang.Object[] toArray()

    - #### @java.lang.Override public java.lang.Object[] toArray(java.lang.Object[] a)

    - #### @java.lang.Override public java.lang.String toString()

      Uses the underlying List's toString so that order is achieved. This means that the decorated Set's toString is not used, so any custom toStrings will be ignored.