GNU Trove

## gnu.trove.decorator
Class TShortHashSetDecorator

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractSet<java.lang.Short>
              gnu.trove.decorator.TShortHashSetDecorator

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, java.lang.Iterable<java.lang.Short>, java.util.Collection<java.lang.Short>, java.util.Set<java.lang.Short>

    public class TShortHashSetDecorator

extends java.util.AbstractSet<java.lang.Short>
implements java.util.Set<java.lang.Short>, java.io.Externalizable

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

Field Summary
`protected TShortHashSet` `_set` the wrapped primitive set

Constructor Summary
`TShortHashSetDecorator()` FOR EXTERNALIZATION ONLY!!
`TShortHashSetDecorator(TShortHashSet set)` Creates a wrapper that decorates the specified primitive set.

Method Summary
`boolean` `add(java.lang.Short value)` Inserts a value into the set.
`void` `clear()` Empties the set.
`TShortHashSetDecorator` `clone()` Clones the underlying trove collection and returns the clone wrapped in a new decorator instance.
`boolean` `equals(java.lang.Object other)` Compares this set with another set for equality of their stored entries.
`TShortHashSet` `getSet()` Returns a reference to the set wrapped by this decorator.
`boolean` `isEmpty()` Indicates whether set has any entries.
`java.util.Iterator<java.lang.Short>` `iterator()` Creates an iterator over the values of the set.
`void` `readExternal(java.io.ObjectInput in)`
`boolean` `remove(java.lang.Object value)` Deletes a value from the set.
`int` `size()` Returns the number of entries in the set.
`protected short` `unwrap(java.lang.Object value)` Unwraps a value
`protected java.lang.Short` `wrap(short k)` Wraps a value
`void` `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class java.util.AbstractSet
`hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`addAll, contains, containsAll, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`addAll, contains, containsAll, hashCode, removeAll, retainAll, toArray, toArray`

Field Detail

### _set

    protected TShortHashSet _set

  the wrapped primitive set

Constructor Detail

### TShortHashSetDecorator

    public TShortHashSetDecorator()

  FOR EXTERNALIZATION ONLY!!

### TShortHashSetDecorator

    public TShortHashSetDecorator(TShortHashSet set)

  Creates a wrapper that decorates the specified primitive set.

Method Detail

### getSet

    public TShortHashSet getSet()

  Returns a reference to the set wrapped by this decorator.

### clone

    public TShortHashSetDecorator 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.

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    a copy of the receiver

### add

    public boolean add(java.lang.Short value)

  Inserts a value into the set.

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

### equals

    public boolean equals(java.lang.Object other)

  Compares this set with another set for equality of their stored entries.

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

### clear

    public void clear()

  Empties the set.

  Specified by:
    `clear` in interface `java.util.Collection<java.lang.Short>`
  Specified by:
    `clear` in interface `java.util.Set<java.lang.Short>`
  Overrides:
    `clear` in class `java.util.AbstractCollection<java.lang.Short>`

### remove

    public boolean remove(java.lang.Object value)

  Deletes a value from the set.

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

### iterator

    public java.util.Iterator<java.lang.Short> iterator()

  Creates an iterator over the values of the set.

  Specified by:
    `iterator` in interface `java.lang.Iterable<java.lang.Short>`
  Specified by:
    `iterator` in interface `java.util.Collection<java.lang.Short>`
  Specified by:
    `iterator` in interface `java.util.Set<java.lang.Short>`
  Specified by:
    `iterator` in class `java.util.AbstractCollection<java.lang.Short>`
  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 `java.util.Collection<java.lang.Short>`
  Specified by:
    `size` in interface `java.util.Set<java.lang.Short>`
  Specified by:
    `size` in class `java.util.AbstractCollection<java.lang.Short>`
  Returns:
    the set's size.

### isEmpty

    public boolean isEmpty()

  Indicates whether set has any entries.

  Specified by:
    `isEmpty` in interface `java.util.Collection<java.lang.Short>`
  Specified by:
    `isEmpty` in interface `java.util.Set<java.lang.Short>`
  Overrides:
    `isEmpty` in class `java.util.AbstractCollection<java.lang.Short>`
  Returns:
    true if the set is empty

### wrap

    protected java.lang.Short wrap(short k)

  Wraps a value

  Parameters:
    `k` - value in the underlying set
  Returns:
    an Object representation of the value

### unwrap

    protected short unwrap(java.lang.Object value)

  Unwraps a value

  Parameters:
    `value` - wrapped value
  Returns:
    an unwrapped representation of the value

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`

GNU Trove

GNU Trove is copyright © 2001-2009 Eric D. Friedman. All Rights Reserved.