Class TByteHashSetDecorator

  • All Implemented Interfaces:
    Iterable<Byte>, Collection<Byte>, Set<Byte>


    public class TByteHashSetDecorator
    extends AbstractSet<Byte>
    implements Set<Byte>
    Wrapper class to make a TByteHashSet conform to the java.util.Set API. This class simply decorates an underlying TByteHashSet 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
    • Field Detail

      • _set

        protected TByteHashSet _set
        the wrapped primitive set
    • Constructor Detail

      • TByteHashSetDecorator

        public TByteHashSetDecorator(TByteHashSet set)
        Creates a wrapper that decorates the specified primitive set.
    • Method Detail

      • getSet

        public TByteHashSet getSet()
        Returns a reference to the set wrapped by this decorator.
      • clone

        public TByteHashSetDecorator 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  Object
        Returns:
        a copy of the receiver
      • add

        public boolean add(Byte value)
        Inserts a value into the set.
        Specified by:
        add in interface  Collection<Byte>
        Specified by:
        add in interface  Set<Byte>
        Overrides:
        add in class  AbstractCollection<Byte>
        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<Byte>
        Specified by:
        equals in interface  Set<Byte>
        Overrides:
        equals in class  AbstractSet<Byte>
        Parameters:
        other - an Object value
        Returns:
        true if the sets are identical
      • clear

        public void clear()
        Empties the set.
      • wrap

        protected Byte wrap(byte k)
        Wraps a value
        Parameters:
        k - value in the underlying set
        Returns:
        an Object representation of the value
      • unwrap

        protected byte unwrap(Object value)
        Unwraps a value
        Parameters:
        value - wrapped value
        Returns:
        an unwrapped representation of the value