JUtil

net.cscott.jutil
Class WorkSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by net.cscott.jutil.WorkSet<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Set<E>

Deprecated. Use LinkedHashSet instead.

public class WorkSet<E>
extends AbstractSet<E>
implements Serializable

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.

Version:
$Id: WorkSet.java,v 1.7 2007-04-09 17:31:28 cananian Exp $
Author:
C. Scott Ananian
See Also:
Serialized Form

Constructor Summary
WorkSet()
          Deprecated. Creates a new, empty WorkSet with a default capacity and load factor.
WorkSet(Collection<? extends E> c)
          Deprecated. Constructs a new WorkSet with the contents of the specified Collection.
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.
 
Method Summary
 boolean add(E o)
          Deprecated. Adds the object to the set and returns true if the element is not already present.
 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.
 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.
 void clear()
          Deprecated. Removes all elements from the set.
 boolean contains(Object o)
          Deprecated. Determines if this contains an item.
 E getFirst()
          Deprecated. Returns the first element in the ordered set.
 E getLast()
          Deprecated. Returns the last element in the ordered set.
 boolean isEmpty()
          Deprecated. Determines if there are any more items left in this.
 Iterator<E> iterator()
          Deprecated. Efficient set iterator.
 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.
 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.
 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 remove(Object o)
          Deprecated.  
 E removeFirst()
          Deprecated. Removes the first element in the ordered set and returns it.
 E removeLast()
          Deprecated. Removes the last element in the ordered set and returns it.
 int size()
          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.Set
addAll, containsAll, retainAll, toArray, toArray
 

Constructor Detail

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 Detail

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 Iterable<E>
Specified by:
iterator in interface Collection<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>

JUtil

Copyright (c) 2006 C. Scott Ananian