Class TDoubleHashSetDecorator

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


    public class TDoubleHashSetDecorator
    extends AbstractSet<Double>
    implements Set<Double>
    Wrapper class to make a TDoubleHashSet conform to the java.util.Set API. This class simply decorates an underlying TDoubleHashSet 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
    • Constructor Detail

      • TDoubleHashSetDecorator

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

      • getSet

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

        public TDoubleHashSetDecorator 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
      • equals

        public boolean equals(Object other)
        Compares this set with another set for equality of their stored entries.
        Specified by:
        equals in interface  Collection<Double>
        Specified by:
        equals in interface  Set<Double>
        Overrides:
        equals in class  AbstractSet<Double>
        Parameters:
        other - an Object value
        Returns:
        true if the sets are identical
      • clear

        public void clear()
        Empties the set.
      • wrap

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

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