Interface MultiSet.Entry<E>

  • Type Parameters:
    E - the element type
    Enclosing interface:
    MultiSet<E>

    public static interface MultiSet.Entry<E>
    An unmodifiable entry for an element and its occurrence as contained in a MultiSet.

    The MultiSet.entrySet() method returns a view of the multiset whose elements implements this interface.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Compares the specified object with this entry for equality.
      int getCount()
      Returns the number of occurrences for the element of this entry.
      E getElement()
      Returns the element corresponding to this entry.
      int hashCode()
      Returns the hash code value for this multiset entry.
    • Method Detail

      • getElement

        E getElement()
        Returns the element corresponding to this entry.
        Returns:
        the element corresponding to this entry
      • getCount

        int getCount()
        Returns the number of occurrences for the element of this entry.
        Returns:
        the number of occurrences of the element
      • equals

        boolean equals​(java.lang.Object o)
        Compares the specified object with this entry for equality. Returns true if the given object is also a multiset entry and the two entries represent the same element with the same number of occurrences.

        More formally, two entries e1 and e2 represent the same mapping if

             (e1.getElement()==null ? e2.getElement()==null
                                    : e1.getElement().equals(e2.getElement())) &&
             (e1.getCount()==e2.getCount())
         
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - object to be compared for equality with this multiset entry
        Returns:
        true if the specified object is equal to this multiset entry
      • hashCode

        int hashCode()
        Returns the hash code value for this multiset entry.

        The hash code of a multiset entry e is defined to be:

              (e==null ? 0 : e.hashCode()) ^ noOccurances)
         
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code value for this multiset entry