Class TLongHashSetDecorator

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


    public class TLongHashSetDecorator
    extends AbstractSet<Long>
    implements Set<Long>
    Wrapper class to make a TLongHashSet conform to the java.util.Set API. This class simply decorates an underlying TLongHashSet 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 TLongHashSet _set
        the wrapped primitive set
    • Constructor Detail

      • TLongHashSetDecorator

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

      • getSet

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

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

        public void clear()
        Empties the set.
      • wrap

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

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