Class WorkSet<E>

All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Set<E>

@Deprecated(since="1.3") public class WorkSet<E> extends AbstractSet<E> implements Serializable
Deprecated.
Use LinkedHashSet instead.
A WorkSet is a Set offering constant-time access to the first/last element inserted, and an iterator whose speed is not dependent on the total capacity of the underlying hashtable.

Conforms to the JDK 1.2 Collections API.

Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Creates a new, empty WorkSet with a default capacity and load factor.
    WorkSet(int initialCapacity)
    Deprecated.
    Constructs a new, empty WorkSet with the specified initial capacity and default load factor.
    WorkSet(int initialCapacity, float loadFactor)
    Deprecated.
    Constructs a new, empty WorkSet with the specified initial capacity and the specified load factor.
    WorkSet(Collection<? extends E> c)
    Deprecated.
    Constructs a new WorkSet with the contents of the specified Collection.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(E o)
    Deprecated.
    Adds the object to the set and returns true if the element is not already present.
    boolean
    Deprecated.
    Adds an element to the front of the (ordered) set and returns true, if the element is not already present in the set.
    boolean
    Deprecated.
    Adds an element to the end of the (ordered) set and returns true, if the element is not already present in the set.
    void
    Deprecated.
    Removes all elements from the set.
    boolean
    Deprecated.
    Determines if this contains an item.
    Deprecated.
    Returns the first element in the ordered set.
    Deprecated.
    Returns the last element in the ordered set.
    boolean
    Deprecated.
    Determines if there are any more items left in this.
    Deprecated.
    Efficient set iterator.
    Deprecated.
    Looks at the object as the top of this WorkSet (treating it as a Stack) without removing it from the set/stack.
    pop()
    Deprecated.
    Removes the item at the top of this WorkSet (treating it as a Stack) and returns that object as the value of this function.
    void
    push(E item)
    Deprecated.
    Pushes item onto the top of this WorkSet (treating it as a Stack), if it is not already there.
    boolean
    Deprecated.
     
    Deprecated.
    Removes the first element in the ordered set and returns it.
    Deprecated.
    Removes the last element in the ordered set and returns it.
    int
    Deprecated.
     

    Methods inherited from class java.util.AbstractSet

    equals, hashCode, removeAll

    Methods inherited from class java.util.AbstractCollection

    addAll, containsAll, retainAll, toArray, toArray, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface java.util.Set

    addAll, containsAll, retainAll, spliterator, toArray, toArray
  • Constructor Details

    • WorkSet

      public WorkSet()
      Deprecated.
      Creates a new, empty WorkSet with a default capacity and load factor.
    • WorkSet

      public WorkSet(int initialCapacity)
      Deprecated.
      Constructs a new, empty WorkSet with the specified initial capacity and default load factor.
    • WorkSet

      public WorkSet(int initialCapacity, float loadFactor)
      Deprecated.
      Constructs a new, empty WorkSet with the specified initial capacity and the specified load factor.
    • WorkSet

      public WorkSet(Collection<? extends E> c)
      Deprecated.
      Constructs a new WorkSet with the contents of the specified Collection.
  • Method Details

    • addFirst

      public boolean addFirst(E o)
      Deprecated.
      Adds an element to the front of the (ordered) set and returns true, if the element is not already present in the set. Makes no change to the set and returns false if the element is already in the set.
    • addLast

      public boolean addLast(E o)
      Deprecated.
      Adds an element to the end of the (ordered) set and returns true, if the element is not already present in the set. Makes no change to the set and returns false if the element is already in the set.
    • getFirst

      public E getFirst()
      Deprecated.
      Returns the first element in the ordered set.
    • getLast

      public E getLast()
      Deprecated.
      Returns the last element in the ordered set.
    • removeFirst

      public E removeFirst()
      Deprecated.
      Removes the first element in the ordered set and returns it.
    • removeLast

      public E removeLast()
      Deprecated.
      Removes the last element in the ordered set and returns it.
    • peek

      public E peek()
      Deprecated.
      Looks at the object as the top of this WorkSet (treating it as a Stack) without removing it from the set/stack.
    • pop

      public E pop()
      Deprecated.
      Removes the item at the top of this WorkSet (treating it as a Stack) and returns that object as the value of this function.
    • push

      public void push(E item)
      Deprecated.
      Pushes item onto the top of this WorkSet (treating it as a Stack), if it is not already there. If the item is already in the set/on the stack, then this method does nothing.
      modifies: this
      effects: If item is not already an element of this, adds item to this. Else does nothing.
    • add

      public boolean add(E o)
      Deprecated.
      Adds the object to the set and returns true if the element is not already present. Otherwise makes no change to the set and returns false.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface Set<E>
      Overrides:
      add in class AbstractCollection<E>
    • clear

      public void clear()
      Deprecated.
      Removes all elements from the set.
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface Set<E>
      Overrides:
      clear in class AbstractCollection<E>
    • contains

      public boolean contains(Object o)
      Deprecated.
      Determines if this contains an item.
      effects: If o is an element of this, returns true. Else returns false.
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface Set<E>
      Overrides:
      contains in class AbstractCollection<E>
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Determines if there are any more items left in this.
      effects: If this has any elements, returns true. Else returns false.
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface Set<E>
      Overrides:
      isEmpty in class AbstractCollection<E>
    • iterator

      public Iterator<E> iterator()
      Deprecated.
      Efficient set iterator.
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface Set<E>
      Specified by:
      iterator in class AbstractCollection<E>
    • remove

      public boolean remove(Object o)
      Deprecated.
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface Set<E>
      Overrides:
      remove in class AbstractCollection<E>
    • size

      public int size()
      Deprecated.
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface Set<E>
      Specified by:
      size in class AbstractCollection<E>