Package gnu.trove.decorator
Class TDoubleHashSetDecorator
- All Implemented Interfaces:
Externalizable,Serializable,Iterable<Double>,Collection<Double>,Set<Double>
public class TDoubleHashSetDecorator
extends AbstractSet<Double>
implements Set<Double>, Externalizable
Wrapper class to make a TDoubleHashSet conform to the java.util.Set API.
This class simply decorates an underlying TDoubleHashSet and translates the Object-based
APIs into their Trove primitive analogs.
Note that wrapping and unwrapping primitive values is extremely inefficient. If
possible, users of this class should override the appropriate methods in this class
and use a table of canonical values.
Created: Tue Sep 24 22:08:17 PDT 2002
- Author:
- Eric D. Friedman
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFOR EXTERNALIZATION ONLY!!Creates a wrapper that decorates the specified primitive set. -
Method Summary
Modifier and TypeMethodDescriptionbooleanInserts a value into the set.voidclear()Empties the set.clone()Clones the underlying trove collection and returns the clone wrapped in a new decorator instance.booleanCompares this set with another set for equality of their stored entries.getSet()Returns a reference to the set wrapped by this decorator.booleanisEmpty()Indicates whether set has any entries.iterator()Creates an iterator over the values of the set.voidbooleanDeletes a value from the set.intsize()Returns the number of entries in the set.protected doubleUnwraps a valueprotected Doublewrap(double k) Wraps a valuevoidMethods inherited from class java.util.AbstractSet
hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, contains, containsAll, hashCode, removeAll, retainAll, spliterator, toArray, toArray
-
Field Details
-
_set
the wrapped primitive set
-
-
Constructor Details
-
TDoubleHashSetDecorator
public TDoubleHashSetDecorator()FOR EXTERNALIZATION ONLY!! -
TDoubleHashSetDecorator
Creates a wrapper that decorates the specified primitive set.
-
-
Method Details
-
getSet
Returns a reference to the set wrapped by this decorator. -
clone
Clones the underlying trove collection and returns the clone wrapped in a new decorator instance. This is a shallow clone except where primitives are concerned. -
add
Inserts a value into the set.- Specified by:
addin interfaceCollection<Double>- Specified by:
addin interfaceSet<Double>- Overrides:
addin classAbstractCollection<Double>- Parameters:
value- true if the set was modified by the insertion
-
equals
Compares this set with another set for equality of their stored entries.- Specified by:
equalsin interfaceCollection<Double>- Specified by:
equalsin interfaceSet<Double>- Overrides:
equalsin classAbstractSet<Double>- Parameters:
other- anObjectvalue- Returns:
- true if the sets are identical
-
clear
public void clear()Empties the set.- Specified by:
clearin interfaceCollection<Double>- Specified by:
clearin interfaceSet<Double>- Overrides:
clearin classAbstractCollection<Double>
-
remove
Deletes a value from the set.- Specified by:
removein interfaceCollection<Double>- Specified by:
removein interfaceSet<Double>- Overrides:
removein classAbstractCollection<Double>- Parameters:
value- anObjectvalue- Returns:
- true if the set was modified
-
iterator
Creates an iterator over the values of the set. -
size
public int size()Returns the number of entries in the set.- Specified by:
sizein interfaceCollection<Double>- Specified by:
sizein interfaceSet<Double>- Specified by:
sizein classAbstractCollection<Double>- Returns:
- the set's size.
-
isEmpty
public boolean isEmpty()Indicates whether set has any entries.- Specified by:
isEmptyin interfaceCollection<Double>- Specified by:
isEmptyin interfaceSet<Double>- Overrides:
isEmptyin classAbstractCollection<Double>- Returns:
- true if the set is empty
-
wrap
Wraps a value- Parameters:
k- value in the underlying set- Returns:
- an Object representation of the value
-
unwrap
Unwraps a value- Parameters:
value- wrapped value- Returns:
- an unwrapped representation of the value
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-