Package net.cscott.jutil
Class WorkSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
net.cscott.jutil.WorkSet<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
Deprecated.
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
ConstructorsConstructorDescriptionWorkSet()Deprecated.Creates a new, emptyWorkSetwith a default capacity and load factor.WorkSet(int initialCapacity) Deprecated.Constructs a new, emptyWorkSetwith the specified initial capacity and default load factor.WorkSet(int initialCapacity, float loadFactor) Deprecated.Constructs a new, emptyWorkSetwith the specified initial capacity and the specified load factor.WorkSet(Collection<? extends E> c) Deprecated.Constructs a newWorkSetwith the contents of the specifiedCollection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.Adds the object to the set and returns true if the element is not already present.booleanDeprecated.Adds an element to the front of the (ordered) set and returns true, if the element is not already present in the set.booleanDeprecated.Adds an element to the end of the (ordered) set and returns true, if the element is not already present in the set.voidclear()Deprecated.Removes all elements from the set.booleanDeprecated.Determines if this contains an item.getFirst()Deprecated.Returns the first element in the ordered set.getLast()Deprecated.Returns the last element in the ordered set.booleanisEmpty()Deprecated.Determines if there are any more items left in this.iterator()Deprecated.Efficient set iterator.peek()Deprecated.pop()Deprecated.voidDeprecated.booleanDeprecated.Deprecated.Removes the first element in the ordered set and returns it.Deprecated.Removes the last element in the ordered set and returns it.intsize()Deprecated.Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
WorkSet
public WorkSet()Deprecated.Creates a new, emptyWorkSetwith a default capacity and load factor. -
WorkSet
public WorkSet(int initialCapacity) Deprecated.Constructs a new, emptyWorkSetwith the specified initial capacity and default load factor. -
WorkSet
public WorkSet(int initialCapacity, float loadFactor) Deprecated.Constructs a new, emptyWorkSetwith the specified initial capacity and the specified load factor. -
WorkSet
Deprecated.Constructs a newWorkSetwith the contents of the specifiedCollection.
-
-
Method Details
-
addFirst
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
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
Deprecated.Returns the first element in the ordered set. -
getLast
Deprecated.Returns the last element in the ordered set. -
removeFirst
Deprecated.Removes the first element in the ordered set and returns it. -
removeLast
Deprecated.Removes the last element in the ordered set and returns it. -
peek
Deprecated. -
pop
Deprecated. -
push
Deprecated. -
add
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:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
clear
public void clear()Deprecated.Removes all elements from the set.- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
contains
Deprecated.Determines if this contains an item.
effects: Ifois an element ofthis, returns true. Else returns false.- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()Deprecated.Determines if there are any more items left in this.
effects: Ifthishas any elements, returns true. Else returns false.- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
iterator
Deprecated.Efficient set iterator. -
remove
Deprecated.- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
size
public int size()Deprecated.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
LinkedHashSetinstead.