/** * Modifies {@code multisetToModify} so that its count for an element {@code e} is at most {@code * multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to {@code * Math.min(multisetToModify.count(e), multisetToRetain.count(e))}. This is similar to {@link * #intersection(Multiset, Multiset) intersection} {@code (multisetToModify, multisetToRetain)}, * but mutates {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps all occurrences of * elements that appear at all in {@code multisetToRetain}, and deletes all occurrences of all * other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result of this operation * @since 10.0 */ @CanIgnoreReturnValue public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element {@code e} is at most {@code * multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to {@code * Math.min(multisetToModify.count(e), multisetToRetain.count(e))}. This is similar to {@link * #intersection(Multiset, Multiset) intersection} {@code (multisetToModify, multisetToRetain)}, * but mutates {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps all occurrences of * elements that appear at all in {@code multisetToRetain}, and deletes all occurrences of all * other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result of this operation * @since 10.0 */ @CanIgnoreReturnValue public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element {@code e} is at most {@code * multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to {@code * Math.min(multisetToModify.count(e), multisetToRetain.count(e))}. This is similar to {@link * #intersection(Multiset, Multiset) intersection} {@code (multisetToModify, multisetToRetain)}, * but mutates {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps all occurrences of * elements that appear at all in {@code multisetToRetain}, and deletes all occurrences of all * other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result of this operation * @since 10.0 */ @CanIgnoreReturnValue public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element * {@code e} is at most {@code multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to * {@code Math.min(multisetToModify.count(e), * multisetToRetain.count(e))}. This is similar to * {@link #intersection(Multiset, Multiset) intersection} * {@code (multisetToModify, multisetToRetain)}, but mutates * {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps * all occurrences of elements that appear at all in {@code * multisetToRetain}, and deletes all occurrences of all other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result * of this operation * @since 10.0 */ @Beta public static boolean retainOccurrences(Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element {@code e} is at most {@code * multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to {@code * Math.min(multisetToModify.count(e), multisetToRetain.count(e))}. This is similar to {@link * #intersection(Multiset, Multiset) intersection} {@code (multisetToModify, multisetToRetain)}, * but mutates {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps all occurrences of * elements that appear at all in {@code multisetToRetain}, and deletes all occurrences of all * other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result of this operation * @since 10.0 */ @CanIgnoreReturnValue public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }
/** * Modifies {@code multisetToModify} so that its count for an element {@code e} is at most {@code * multisetToRetain.count(e)}. * * <p>To be precise, {@code multisetToModify.count(e)} is set to {@code * Math.min(multisetToModify.count(e), multisetToRetain.count(e))}. This is similar to {@link * #intersection(Multiset, Multiset) intersection} {@code (multisetToModify, multisetToRetain)}, * but mutates {@code multisetToModify} instead of returning a view. * * <p>In contrast, {@code multisetToModify.retainAll(multisetToRetain)} keeps all occurrences of * elements that appear at all in {@code multisetToRetain}, and deletes all occurrences of all * other elements. * * @return {@code true} if {@code multisetToModify} was changed as a result of this operation * @since 10.0 */ @CanIgnoreReturnValue public static boolean retainOccurrences( Multiset<?> multisetToModify, Multiset<?> multisetToRetain) { return retainOccurrencesImpl(multisetToModify, multisetToRetain); }