Home | History | Annotate | Download | only in collect

Lines Matching refs:element

35  * element equivalence", below) are referred to as <i>occurrences</i> of the
36 * same single element. The total number of occurrences of an element in a
37 * multiset is called the <i>count</i> of that element (the terms "frequency"
39 * of an element is represented as an {@code int}, a multiset may never contain
40 * more than {@link Integer#MAX_VALUE} occurrences of any one element.
44 * #count}, which returns the count of an element. There are five new
46 * or remove multiple occurrences of an element at once, or to set the count of
47 * an element to a specific value. These modification operations are optional,
53 * Multiset.Entry} instances, each providing both a distinct element and the
54 * count of that element.
81 * Returns the number of occurrences of an element in this multiset (the
82 * <i>count</i> of the element). Note that for an {@link Object#equals}-based
90 * @param element the element to count occurrences of
91 * @return the number of occurrences of the element in this multiset; possibly
94 int count(@Nullable Object element);
99 * Adds a number of occurrences of an element to this multiset. Note that if
102 * of overflow) to the call {@code addAll(Collections.nCopies(element,
105 * @param element the element to add occurrences of; may be {@code null} only
107 * @param occurrences the number of occurrences of the element to add. May be
109 * @return the count of the element before the operation; possibly zero
112 * occurrences of the element
113 * @throws NullPointerException if {@code element} is null and this
117 int add(@Nullable E element, int occurrences);
120 * Removes a number of occurrences of the specified element from this
124 * {@code remove(element)}.
126 * @param element the element to conditionally remove occurrences of
127 * @param occurrences the number of occurrences of the element to remove. May
129 * @return the count of the element before the operation; possibly zero
132 int remove(@Nullable Object element, int occurrences);
135 * Adds or removes the necessary occurrences of an element such that the
136 * element attains the desired count.
138 * @param element the element to add or remove occurrences of; may be null
140 * @param count the desired count of the element in this multiset
141 * @return the count of the element before the operation; possibly zero
143 * @throws NullPointerException if {@code element} is null and this
147 int setCount(E element, int count);
150 * Conditionally sets the count of an element to a new value, as described in
151 * {@link #setCount(Object, int)}, provided that the element has the expected
155 * @param element the element to conditionally set the count of; may be null
157 * @param oldCount the expected present count of the element in this multiset
158 * @param newCount the desired count of the element in this multiset
164 * @throws NullPointerException if {@code element} is null and the
169 boolean setCount(E element, int oldCount, int newCount);
175 * element set is backed by the same data as the multiset, so any change to
177 * the element set is unspecified.
179 * <p>If the element set supports any removal operations, these necessarily
180 * cause <b>all</b> occurrences of the removed element(s) to be removed from
184 * <p>A common use for the element set is to find the number of distinct
193 * Multiset.Entry} instances, each providing an element of the multiset and
194 * the count of that element. This set contains exactly one entry for each
195 * distinct element in the multiset (thus it always has the same size as the
196 * {@link #elementSet}). The order of the elements in the element set is
213 * An unmodifiable element-count pair for a multiset. The {@link
223 * Returns the multiset element corresponding to this entry. Multiple calls
226 * @return the element corresponding to this entry
231 * Returns the count of the associated element in the underlying multiset.
234 * element in the multiset, depending on the implementation. Note that in
236 * it will return zero if all occurrences of the element were since removed
239 * @return the count of the element; never negative
247 * the two entries represent the same element and count. More formally, two
260 * <p>The hash code of a multiset entry for element {@code element} and
263 * <pre> (element == null ? 0 : element.hashCode()) ^ count</pre>
270 * representation of the corresponding element. Otherwise, it is the string
271 * representation of the element, followed by the three characters {@code
290 * <pre> (element == null ? 0 : element.hashCode()) ^ count(element)</pre>
320 * Determines whether this multiset contains the specified element.
323 * it <b>may not</b> throw an exception in response to {@code element} being
326 * @param element the element to check for
328 * the element
330 boolean contains(@Nullable Object element);
334 * each element in the specified collection.
341 * count of an element in the two collections; it may still return {@code
342 * true} even if {@code elements} contains several occurrences of an element
350 * each element contained in {@code elements}
356 * Adds a single occurrence of the specified element to this multiset.
359 * the presence of the element, to further specify that a successful call must
360 * always increment the count of the element, and the overall size of the
363 * @param element the element to add one occurrence of; may be null only if
367 * @throws NullPointerException if {@code element} is null and this
370 * of {@code element} are already contained in this multiset
372 element);
375 * Removes a <i>single</i> occurrence of the specified element from this
379 * <b>may not</b> throw an exception in response to {@code element} being null
382 * @param element the element to remove one occurrence of
385 boolean remove(@Nullable Object element);