Lines Matching refs:elements

31  * An immutable {@code SortedMultiset} that stores its elements in a sorted array. Some instances
33 * elements. Either way, null elements are not supported.
49 * {@code ImmutableSortedMultiset} doesn't use {@link Object#equals} to determine if two elements
51 * elements {@code x} and {@code y} are equivalent:
57 * With natural ordering of elements, the following relation determines whether two elements are
101 * Returns an immutable sorted multiset containing the given elements sorted by their natural
112 * Returns an immutable sorted multiset containing the given elements sorted by their natural
123 * Returns an immutable sorted multiset containing the given elements sorted by their natural
135 * Returns an immutable sorted multiset containing the given elements sorted by their natural
147 * Returns an immutable sorted multiset containing the given elements sorted by their natural
169 * Returns an immutable sorted multiset containing the given elements sorted by their natural
172 * @throws NullPointerException if any of {@code elements} is null
174 public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> copyOf(E[] elements) {
175 return copyOf(Ordering.natural(), Arrays.asList(elements));
179 * Returns an immutable sorted multiset containing the given elements sorted by their natural
181 * comparator, call {@link #copyOfSorted} instead. This method iterates over {@code elements} at
194 * <p>This method is not type-safe, as it may be called on elements that are not mutually
197 * @throws ClassCastException if the elements are not mutually comparable
198 * @throws NullPointerException if any of {@code elements} is null
200 public static <E> ImmutableSortedMultiset<E> copyOf(Iterable<? extends E> elements) {
205 return copyOf(naturalOrder, elements);
209 * Returns an immutable sorted multiset containing the given elements sorted by their natural
212 * <p>This method is not type-safe, as it may be called on elements that are not mutually
215 * @throws ClassCastException if the elements are not mutually comparable
216 * @throws NullPointerException if any of {@code elements} is null
218 public static <E> ImmutableSortedMultiset<E> copyOf(Iterator<? extends E> elements) {
223 return copyOfInternal(naturalOrder, elements);
227 * Returns an immutable sorted multiset containing the given elements sorted by the given {@code
230 * @throws NullPointerException if {@code comparator} or any of {@code elements} is null
233 Comparator<? super E> comparator, Iterator<? extends E> elements) {
235 return copyOfInternal(comparator, elements);
239 * Returns an immutable sorted multiset containing the given elements sorted by the given {@code
240 * Comparator}. This method iterates over {@code elements} at most once.
246 * @throws NullPointerException if {@code comparator} or any of {@code elements} is null
249 Comparator<? super E> comparator, Iterable<? extends E> elements) {
251 return copyOfInternal(comparator, elements);
255 * Returns an immutable sorted multiset containing the elements of a sorted multiset, sorted by
257 * always uses the natural ordering of the elements.
266 * @throws NullPointerException if {@code sortedMultiset} or any of its elements is null
334 // compare two elements, it'll throw a CCE. Only methods that are specified to
424 * Returns a builder that creates immutable sorted multisets whose elements are ordered by the
436 * Returns a builder that creates immutable sorted multisets whose elements are ordered by their
525 * Adds each element of {@code elements} to the {@code ImmutableSortedMultiset}.
527 * @param elements the elements to add
529 * @throws NullPointerException if {@code elements} is null or contains a null element
532 public Builder<E> add(E... elements) {
533 super.add(elements);
538 * Adds each element of {@code elements} to the {@code ImmutableSortedMultiset}.
540 * @param elements the {@code Iterable} to add to the {@code ImmutableSortedMultiset}
542 * @throws NullPointerException if {@code elements} is null or contains a null element
545 public Builder<E> addAll(Iterable<? extends E> elements) {
546 super.addAll(elements);
551 * Adds each element of {@code elements} to the {@code ImmutableSortedMultiset}.
553 * @param elements the elements to add to the {@code ImmutableSortedMultiset}
555 * @throws NullPointerException if {@code elements} is null or contains a null element
558 public Builder<E> addAll(Iterator<? extends E> elements) {
559 super.addAll(elements);
575 Object[] elements;
581 elements = new Object[n];
585 elements[i] = entry.getElement();
593 int n = elements.length;
596 builder.addCopies(elements[i], counts[i]);