Class ListOrderedSet

  • All Implemented Interfaces:
    Serializable, Iterable, Collection, Set

    public class ListOrderedSet
    extends AbstractSerializableSetDecorator
    implements Set
    Decorates another Set to ensure that the order of addition is retained and used by the iterator.

    If an object is added to the set for a second time, it will remain in the original position in the iteration. The order can be observed from the set via the iterator or toArray methods.

    The ListOrderedSet also has various useful direct methods. These include many from List, such as get(int), remove(int) and indexOf(int). An unmodifiable List view of the set can be obtained via asList().

    This class cannot implement the List interface directly as various interface methods (notably equals/hashCode) are incompatable with a set.

    This class is Serializable from Commons Collections 3.1.

    Since:
    Commons Collections 3.0
    Version:
    $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
    Author:
    Stephen Colebourne, Henning P. Schmiedehausen
    See Also:
    Serialized Form