ListOrderedSet (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.binding
[Java] Class ListOrderedSet

    java.lang.Object
      org.apache.commons.collections.collection.AbstractCollectionDecorator
          org.apache.commons.collections.set.AbstractSetDecorator
              org.apache.commons.collections.set.AbstractSerializableSetDecorator
                  org.codehaus.groovy.grails.web.binding.ListOrderedSet

All Implemented Interfaces:
  java.util.List

    @java.lang.SuppressWarnings({"rawtypes", "unchecked"})
    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.

Authors:
  Stephen Colebourne
  Henning P. Schmiedehausen
  Graeme Rocher

Field Summary
`protected java.util.List` | `setOrder` Internal list to hold the sequence of objects

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class org.apache.commons.collections.set.AbstractSerializableSetDecorator
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#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(), org.apache.commons.collections.set.AbstractSerializableSetDecorator#toArray([Ljava.lang.Object;), org.apache.commons.collections.set.AbstractSerializableSetDecorator#addAll(java.util.Collection), org.apache.commons.collections.set.AbstractSerializableSetDecorator#iterator(), 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()

Methods inherited from class org.apache.commons.collections.set.AbstractSetDecorator
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#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(), org.apache.commons.collections.set.AbstractSetDecorator#toArray([Ljava.lang.Object;), org.apache.commons.collections.set.AbstractSetDecorator#addAll(java.util.Collection), org.apache.commons.collections.set.AbstractSetDecorator#iterator(), 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

### setOrder

    protected final java.util.List setOrder

  Internal list to hold the sequence of objects

Constructor Detail

### ListOrderedSet

    public ListOrderedSet()

  Constructs a new empty ListOrderedSet using a HashSet and an ArrayList internally.
  Since:
    Commons Collections 3.1

### ListOrderedSet

    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

### ListOrderedSet

    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

### add

    @java.lang.Override// re-adding doesn't change order
    public boolean add(java.lang.Object object)

### add

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

### addAll

    @java.lang.Overrideresult = result | add(object);
    public boolean addAll(java.util.Collection coll)

### addAll

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

### asList

    public java.util.List asList()

  Gets an unmodifiable view of the order of the Set.
  Returns:
    an unmodifiable list view

### clear

    @java.lang.OverridesetOrder.clear();
    public void clear()

### decorate

    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

### decorate

    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

### get

    public java.lang.Object get(int index)

### indexOf

    public int indexOf(java.lang.Object object)

### iterator

    @java.lang.Override}
    public java.util.Iterator iterator()

### lastIndexOf

    public int lastIndexOf(java.lang.Object o)

### listIterator

    public java.util.ListIterator listIterator()

### listIterator

    public java.util.ListIterator listIterator(int index)

### remove

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

### remove

    public java.lang.Object remove(int index)

### removeAll

    @java.lang.Overrideresult = result | remove(object);
    public boolean removeAll(java.util.Collection coll)

### retainAll

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

### set

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

### subList

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

### toArray

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

### toArray

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

### toString

    @java.lang.Override* Internal iterator handle remove.
    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.

Groovy Documentation