Lines Matching defs:elements

37  * An immutable hash-based multiset. Does not permit null elements.
39 * <p>Its iterator orders elements according to the first appearance of the
74 * Returns an immutable multiset containing the given elements, in order.
85 * Returns an immutable multiset containing the given elements, in order.
96 * Returns an immutable multiset containing the given elements, in order.
107 * Returns an immutable multiset containing the given elements, in order.
118 * Returns an immutable multiset containing the given elements, in order.
134 * Returns an immutable multiset containing the given elements.
138 * elements in the order {@code 2, 3, 3, 1}.
140 * @throws NullPointerException if any of {@code elements} is null
146 public static <E> ImmutableMultiset<E> of(E[] elements) {
147 return copyOf(Arrays.asList(elements));
151 * Returns an immutable multiset containing the given elements.
155 * with elements in the order {@code 2, 3, 3, 1}.
157 * @throws NullPointerException if any of {@code elements} is null
160 public static <E> ImmutableMultiset<E> copyOf(E[] elements) {
161 return copyOf(Arrays.asList(elements));
165 * Returns an immutable multiset containing the given elements.
169 * a multiset with elements in the order {@code 2, 3, 3, 1}.
175 * <p><b>Note:</b> Despite what the method name suggests, if {@code elements}
179 * @throws NullPointerException if any of {@code elements} is null
182 Iterable<? extends E> elements) {
183 if (elements instanceof ImmutableMultiset) {
185 ImmutableMultiset<E> result = (ImmutableMultiset<E>) elements;
191 Multiset<? extends E> multiset = (elements instanceof Multiset)
192 ? Multisets.cast(elements)
193 : LinkedHashMultiset.create(elements);
198 private static <E> ImmutableMultiset<E> copyOfInternal(E... elements) {
199 return copyOf(Arrays.asList(elements));
228 * Returns an immutable multiset containing the given elements.
233 * yields a multiset with elements in the order {@code 2, 3, 3, 1}.
235 * @throws NullPointerException if any of {@code elements} is null
238 Iterator<? extends E> elements) {
240 Iterators.addAll(multiset, elements);
458 final Object[] elements;
463 elements = new Object[distinct];
467 elements[i] = entry.getElement();
475 LinkedHashMultiset.create(elements.length);
476 for (int i = 0; i < elements.length; i++) {
477 multiset.add(elements[i], counts[i]);
578 * Adds each element of {@code elements} to the {@code ImmutableMultiset}.
580 * @param elements the elements to add
582 * @throws NullPointerException if {@code elements} is null or contains a
585 @Override public Builder<E> add(E... elements) {
586 super.add(elements);
591 * Adds each element of {@code elements} to the {@code ImmutableMultiset}.
593 * @param elements the {@code Iterable} to add to the {@code
596 * @throws NullPointerException if {@code elements} is null or contains a
599 @Override public Builder<E> addAll(Iterable<? extends E> elements) {
600 if (elements instanceof Multiset) {
601 Multiset<? extends E> multiset = Multisets.cast(elements);
606 super.addAll(elements);
612 * Adds each element of {@code elements} to the {@code ImmutableMultiset}.
614 * @param elements the elements to add to the {@code ImmutableMultiset}
616 * @throws NullPointerException if {@code elements} is null or contains a
619 @Override public Builder<E> addAll(Iterator<? extends E> elements) {
620 super.addAll(elements);