Package com.day.util

Class OrderedSet

  • All Implemented Interfaces:
    Iterable, Collection, Set

    public class OrderedSet
    extends Object
    implements Set
    Helper class that implements a set, but preserves the order of inserting the elements when accessing an iterator.
    Since:
    coati, moved to com.day.util for iguana Audience core
    • Constructor Detail

      • OrderedSet

        public OrderedSet()
        Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).
      • OrderedSet

        public OrderedSet​(Collection c)
        Constructs a new set containing the elements in the specified collection. The Set is created with default load factor (0.75) and an initial capacity sufficient to contain the elements in the specified collection.
        Parameters:
        c - the collection whose elements are to be placed into this set.
        Throws:
        NullPointerException - if the specified collection is null.
      • OrderedSet

        public OrderedSet​(int initialCapacity,
                          float loadFactor)
        Constructs a new, empty set; the backing Set instance has the specified initial capacity and the specified load factor.
        Parameters:
        initialCapacity - the initial capacity of the hash map.
        loadFactor - the load factor of the hash map.
        Throws:
        IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is nonpositive.
      • OrderedSet

        public OrderedSet​(int initialCapacity)
        Constructs a new, empty set; the backing Set instance has the specified initial capacity and default load factor, which is 0.75.
        Parameters:
        initialCapacity - the initial capacity of the hash table.
        Throws:
        IllegalArgumentException - if the initial capacity is less than zero.