Package gnu.trove.decorator
Class TIntSetDecorator
- All Implemented Interfaces:
Externalizable,Serializable,Iterable<Integer>,Collection<Integer>,Set<Integer>
Wrapper class to make a TIntSet conform to the java.util.Set API. This class simply decorates an underlying TIntSet 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- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFOR EXTERNALIZATION ONLY!!TIntSetDecorator(TIntSet set) Creates a wrapper that decorates the specified primitive set. -
Method Summary
Modifier and TypeMethodDescriptionbooleanInserts a value into the set.voidclear()Empties the set.booleanbooleanCompares 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.voidMethods inherited from class java.util.AbstractSet
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, hashCode, removeAll, retainAll, spliterator, toArray, toArray
-
Field Details
-
_set
the wrapped primitive set
-
-
Constructor Details
-
TIntSetDecorator
public TIntSetDecorator()FOR EXTERNALIZATION ONLY!! -
TIntSetDecorator
Creates a wrapper that decorates the specified primitive set.- Parameters:
set- the TIntSet to wrap.
-
-
Method Details
-
getSet
Returns a reference to the set wrapped by this decorator.- Returns:
- the wrapped TIntSet instance.
-
add
Inserts a value into the set.- Specified by:
addin interfaceCollection<Integer>- Specified by:
addin interfaceSet<Integer>- Overrides:
addin classAbstractCollection<Integer>- 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<Integer>- Specified by:
equalsin interfaceSet<Integer>- Overrides:
equalsin classAbstractSet<Integer>- Parameters:
other- anObjectvalue- Returns:
- true if the sets are identical
-
clear
public void clear()Empties the set.- Specified by:
clearin interfaceCollection<Integer>- Specified by:
clearin interfaceSet<Integer>- Overrides:
clearin classAbstractCollection<Integer>
-
remove
Deletes a value from the set.- Specified by:
removein interfaceCollection<Integer>- Specified by:
removein interfaceSet<Integer>- Overrides:
removein classAbstractCollection<Integer>- 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<Integer>- Specified by:
sizein interfaceSet<Integer>- Specified by:
sizein classAbstractCollection<Integer>- Returns:
- the set's size.
-
isEmpty
public boolean isEmpty()Indicates whether set has any entries.- Specified by:
isEmptyin interfaceCollection<Integer>- Specified by:
isEmptyin interfaceSet<Integer>- Overrides:
isEmptyin classAbstractCollection<Integer>- Returns:
- true if the set is empty
-
contains
- Specified by:
containsin interfaceCollection<Integer>- Specified by:
containsin interfaceSet<Integer>- Overrides:
containsin classAbstractCollection<Integer>
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-