Class EquivalentHashSet<E>

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

    public class EquivalentHashSet<E>
    extends AbstractSet<E>
    Deprecated.
    Custom hash-based set which accepts no null values, where equality and hash code calculations are done based on passed Equivalence function implementations for values, as opposed to relying on their own equals/hashCode/toString implementations. This is handy when using key/values whose mentioned methods cannot be overriden, i.e. arrays, and in situations where users want to avoid using wrapper objects.
    Since:
    5.3
    Author:
    Galder ZamarreƱo
    • Constructor Detail

      • EquivalentHashSet

        public EquivalentHashSet​(Equivalence<? super E> entryEq)
        Deprecated.
        Constructs a new, empty set, with a given equivalence function
        Parameters:
        entryEq - the Equivalence function to be used to compare entries in this set.
      • EquivalentHashSet

        public EquivalentHashSet​(int initialCapacity,
                                 Equivalence<? super E> entryEq)
        Deprecated.
        Constructs a new, empty set, with a given initial capacity and a particular equivalence function to compare entries.
        Parameters:
        initialCapacity - this set's initial capacity
        entryEq - the Equivalence function to be used to compare entries in this set.
    • Method Detail

      • size

        public int size()
        Deprecated.
        Returns the number of elements in this set. If this set contains more than Integer.MAX_VALUE elements, it returns Integer.MAX_VALUE.
        Specified by:
        size in interface Collection<E>
        Specified by:
        size in interface Set<E>
        Specified by:
        size in class AbstractCollection<E>
        Returns:
        the number of elements in this set
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Returns true if this set contains no elements.
        Specified by:
        isEmpty in interface Collection<E>
        Specified by:
        isEmpty in interface Set<E>
        Overrides:
        isEmpty in class AbstractCollection<E>
        Returns:
        true if this set contains no elements
      • contains

        public boolean contains​(Object o)
        Deprecated.
        Returns true if this set contains the specified element.
        Specified by:
        contains in interface Collection<E>
        Specified by:
        contains in interface Set<E>
        Overrides:
        contains in class AbstractCollection<E>
        Parameters:
        o - the object to be checked for containment in this set
        Returns:
        true if this set contains the specified element
      • add

        public boolean add​(E o)
        Deprecated.
        Adds the specified element to this set if it is not already present.
        Specified by:
        add in interface Collection<E>
        Specified by:
        add in interface Set<E>
        Overrides:
        add in class AbstractCollection<E>
        Parameters:
        o - element to be added to this set
        Returns:
        true if the set did not already contain the specified element
      • remove

        public boolean remove​(Object o)
        Deprecated.
        Removes the specified element from this set if it is present.
        Specified by:
        remove in interface Collection<E>
        Specified by:
        remove in interface Set<E>
        Overrides:
        remove in class AbstractCollection<E>
        Parameters:
        o - object to be removed from this set, if present
        Returns:
        true if the set contained the specified element