Package gnu.trove.decorator

# Class TCharSetDecorator

java.lang.Object
java.util.AbstractCollection<Character>
java.util.AbstractSet<Character>
gnu.trove.decorator.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:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected TCharSet`
`_set`
the wrapped primitive set

## Constructor Summary

Constructors
Constructor
Description
`TCharSetDecorator()`
FOR EXTERNALIZATION ONLY!!
`TCharSetDecorator(TCharSet set)`
Creates a wrapper that decorates the specified primitive set.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`add(Character value)`
Inserts a value into the set.
`void`
`clear()`
Empties the set.
`boolean`
`contains(Object o)`
`boolean`
`equals(Object other)`
Compares this set with another set for equality of their stored entries.
`TCharSet`
`getSet()`
Returns a reference to the set wrapped by this decorator.
`boolean`
`isEmpty()`
Indicates whether set has any entries.
`Iterator<Character>`
`iterator()`
Creates an iterator over the values of the set.
`void`
`readExternal(ObjectInput in)`
`boolean`
`remove(Object value)`
Deletes a value from the set.
`int`
`size()`
Returns the number of entries in the set.
`void`
`writeExternal(ObjectOutput out)`

### 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.lang.Iterable

`forEach`

### Methods inherited from interface java.util.Set

`addAll, containsAll, hashCode, removeAll, retainAll, spliterator, toArray, toArray`

## Field Details

### _set

protected TCharSet _set
the wrapped primitive set

## Constructor Details

### TCharSetDecorator

public TCharSetDecorator()
FOR EXTERNALIZATION ONLY!!

### TCharSetDecorator

public TCharSetDecorator(TCharSet set)
Creates a wrapper that decorates the specified primitive set.

Parameters:
  `set` - the `TCharSet` to wrap.

## Method Details

### getSet

public TCharSet getSet()
Returns a reference to the set wrapped by this decorator.

Returns:
  the wrapped `TCharSet` instance.

### add

public boolean add(Character value)
Inserts a value into the set.

Specified by:
  `add` in interface `Collection<Character>`
Specified by:
  `add` in interface `Set<Character>`
Overrides:
  `add` in class `AbstractCollection<Character>`
Parameters:
  `value` - true if the set was modified by the insertion

### equals

public boolean equals(Object other)
Compares this set with another set for equality of their stored entries.

Specified by:
  `equals` in interface `Collection<Character>`
Specified by:
  `equals` in interface `Set<Character>`
Overrides:
  `equals` in class `AbstractSet<Character>`
Parameters:
  `other` - an `Object` value
Returns:
  true if the sets are identical

### clear

public void clear()
Empties the set.

Specified by:
  `clear` in interface `Collection<Character>`
Specified by:
  `clear` in interface `Set<Character>`
Overrides:
  `clear` in class `AbstractCollection<Character>`

### remove

public boolean remove(Object value)
Deletes a value from the set.

Specified by:
  `remove` in interface `Collection<Character>`
Specified by:
  `remove` in interface `Set<Character>`
Overrides:
  `remove` in class `AbstractCollection<Character>`
Parameters:
  `value` - an `Object` value
Returns:
  true if the set was modified

### iterator

public Iterator<Character> iterator()
Creates an iterator over the values of the set.

Specified by:
  `iterator` in interface `Collection<Character>`
Specified by:
  `iterator` in interface `Iterable<Character>`
Specified by:
  `iterator` in interface `Set<Character>`
Specified by:
  `iterator` in class `AbstractCollection<Character>`
Returns:
  an iterator with support for removals in the underlying set

### size

public int size()
Returns the number of entries in the set.

Specified by:
  `size` in interface `Collection<Character>`
Specified by:
  `size` in interface `Set<Character>`
Specified by:
  `size` in class `AbstractCollection<Character>`
Returns:
  the set's size.

### isEmpty

public boolean isEmpty()
Indicates whether set has any entries.

Specified by:
  `isEmpty` in interface `Collection<Character>`
Specified by:
  `isEmpty` in interface `Set<Character>`
Overrides:
  `isEmpty` in class `AbstractCollection<Character>`
Returns:
  true if the set is empty

### contains

public boolean contains(Object o)

Specified by:
  `contains` in interface `Collection<Character>`
Specified by:
  `contains` in interface `Set<Character>`
Overrides:
  `contains` in class `AbstractCollection<Character>`

### readExternal

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

### writeExternal

public void writeExternal(ObjectOutput out) throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`