/** * Returns the frequency of the specified element in this set. * * @param element the element whose frequency is to be obtained. * @return the frequency of the given element, or {@code 0} if it does not occur in this set. */ public int frequency(final E element) { return signedFrequency(element) ^ order; }
/** * Returns the frequency of the specified element in this set. * * @param element the element whose frequency is to be obtained. * @return the frequency of the given element, or {@code 0} if it does not occur in this set. */ public int frequency(final E element) { return signedFrequency(element) ^ order; }
/** * Compares the specified elements for {@linkplain #frequency frequency}. For {@code FrequencySortedSet} * with default ordering, this method returns a positive number if {@code o1} has been added more frequently * to this set than {@code o2}, a negative number if {@code o1} has been added less frequently than {@code o2}, * and 0 otherwise. For {@code FrequencySortedSet} with reverse ordering, this is the converse. * * <p>This method is final because the {@code FrequencySortedSet} implementation makes * assumptions on the comparator that would not hold if this method were overridden.</p> */ @Override public final int compare(final E o1, final E o2) { return signedFrequency(o1) - signedFrequency(o2); }
/** * Compares the specified elements for {@linkplain #frequency frequency}. For {@code FrequencySortedSet} * with default ordering, this method returns a positive number if {@code o1} has been added more frequently * to this set than {@code o2}, a negative number if {@code o1} has been added less frequently than {@code o2}, * and 0 otherwise. For {@code FrequencySortedSet} with reverse ordering, this is the converse. * * <p>This method is final because the {@code FrequencySortedSet} implementation makes * assumptions on the comparator that would not hold if this method were overridden.</p> */ @Override public final int compare(final E o1, final E o2) { return signedFrequency(o1) - signedFrequency(o2); }