Class ListOrderedSet

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

    public class ListOrderedSet
    extends AbstractSerializableSetDecorator
    implements Set
    Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.
    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.

    Commons Collections 3.0
    See Also:
    Serialized Form