Package net.cscott.jutil
Class PersistentSetFactory<T>
java.lang.Object
net.cscott.jutil.PersistentSetFactory<T>
- All Implemented Interfaces:
CollectionFactory<T>,SetFactory<T>
A
PersistentSetFactory uses hash-consing to ensure that
the Sets created by it maximally reuse space.
Equality tests between Sets created by this factory are
constant-time. Cloning a Set created by this factory is
also constant-time. The implementation is based on persistent
randomized treaps.- Since:
- 1.1
- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentSetFactory(Comparator<T> comparator) Creates aPersistentSetFactory. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.cscott.jutil.SetFactory
makeCollection, makeCollection, makeCollection, makeSet, makeSet
-
Constructor Details
-
PersistentSetFactory
Creates aPersistentSetFactory. Note that the elements must implement a good hashcode as well as being comparable.
-
-
Method Details
-
makeSet
Generates a new unsynchronized mutableSetwhich is based on persistent randomized treaps. AllSets created by this factory maximally reuse space, and have very fast equality-test and clone operations.- Specified by:
makeSetin interfaceSetFactory<T>
-