Package gnu.trove.decorator
Class TCharSetDecorator
- All Implemented Interfaces:
Externalizable
,Serializable
,Iterable<Character>
,Collection<Character>
,Set<Character>
public class TCharSetDecorator
extends AbstractSet<Character>
implements Set<Character>, Externalizable
Wrapper class to make a TCharSet conform to the java.util.Set API. This class simply decorates an underlying TCharSet 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!!Creates a wrapper that decorates the specified primitive set. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Inserts a value into the set.void
clear()
Empties the set.boolean
boolean
Compares this set with another set for equality of their stored entries.getSet()
Returns a reference to the set wrapped by this decorator.boolean
isEmpty()
Indicates whether set has any entries.iterator()
Creates an iterator over the values of the set.void
boolean
Deletes a value from the set.int
size()
Returns the number of entries in the set.void
Methods inherited from class java.util.AbstractSet
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.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
addAll, containsAll, hashCode, removeAll, retainAll, spliterator, toArray, toArray
-
Field Details
-
_set
the wrapped primitive set
-
-
Constructor Details
-
TCharSetDecorator
public TCharSetDecorator()FOR EXTERNALIZATION ONLY!! -
TCharSetDecorator
Creates a wrapper that decorates the specified primitive set.- Parameters:
set
- the TCharSet to wrap.
-
-
Method Details
-
getSet
Returns a reference to the set wrapped by this decorator.- Returns:
- the wrapped TCharSet instance.
-
add
Inserts a value into the set.- Specified by:
add
in interfaceCollection<Character>
- Specified by:
add
in interfaceSet<Character>
- Overrides:
add
in classAbstractCollection<Character>
- 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:
equals
in interfaceCollection<Character>
- Specified by:
equals
in interfaceSet<Character>
- Overrides:
equals
in classAbstractSet<Character>
- Parameters:
other
- anObject
value- Returns:
- true if the sets are identical
-
clear
public void clear()Empties the set.- Specified by:
clear
in interfaceCollection<Character>
- Specified by:
clear
in interfaceSet<Character>
- Overrides:
clear
in classAbstractCollection<Character>
-
remove
Deletes a value from the set.- Specified by:
remove
in interfaceCollection<Character>
- Specified by:
remove
in interfaceSet<Character>
- Overrides:
remove
in classAbstractCollection<Character>
- Parameters:
value
- anObject
value- 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:
size
in interfaceCollection<Character>
- Specified by:
size
in interfaceSet<Character>
- Specified by:
size
in classAbstractCollection<Character>
- Returns:
- the set's size.
-
isEmpty
public boolean isEmpty()Indicates whether set has any entries.- Specified by:
isEmpty
in interfaceCollection<Character>
- Specified by:
isEmpty
in interfaceSet<Character>
- Overrides:
isEmpty
in classAbstractCollection<Character>
- Returns:
- true if the set is empty
-
contains
- Specified by:
contains
in interfaceCollection<Character>
- Specified by:
contains
in interfaceSet<Character>
- Overrides:
contains
in classAbstractCollection<Character>
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-