gnu.trove.decorator

Class TIntHashSetDecorator

public class TIntHashSetDecorator extends AbstractSet implements Set

Wrapper class to make a TIntHashSet conform to the java.util.Set API. This class simply decorates an underlying TIntHashSet 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

Since: trove 0.1.8

Version: $Id: TIntHashSetDecorator.java,v 1.2 2002/09/25 05:14:38 ericdf Exp $

Author: Eric D. Friedman

Field Summary
protected TIntHashSet_set
the wrapped primitive set
Constructor Summary
TIntHashSetDecorator(TIntHashSet set)
Creates a wrapper that decorates the specified primitive set.
Method Summary
booleanadd(Object value)
Inserts a value into the set.
voidclear()
Empties the set.
booleanequals(Object other)
Compares this set with another set for equality of their stored entries.
booleanisEmpty()
Indicates whether set has any entries.
Iteratoriterator()
Creates an iterator over the values of the set.
booleanremove(Object value)
Deletes a value from the set.
intsize()
Returns the number of entries in the set.
protected intunwrap(Object value)
Unwraps a value
protected Integerwrap(int k)
Wraps a value

Field Detail

_set

protected final TIntHashSet _set
the wrapped primitive set

Constructor Detail

TIntHashSetDecorator

public TIntHashSetDecorator(TIntHashSet set)
Creates a wrapper that decorates the specified primitive set.

Method Detail

add

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

Parameters: true if the set was modified by the insertion

clear

public void clear()
Empties the set.

equals

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

Parameters: other an Object value

Returns: true if the sets are identical

isEmpty

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

Returns: true if the set is empty

iterator

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

Returns: an iterator with support for removals in the underlying set

remove

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

Parameters: value an Object value

Returns: true if the set was modified

size

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

Returns: the set's size.

unwrap

protected int unwrap(Object value)
Unwraps a value

Parameters: a wrapped value

Returns: an unwrapped representation of the value

wrap

protected Integer wrap(int k)
Wraps a value

Parameters: a value in the underlying set

Returns: an Object representation of the value