Lines Matching defs:elements

39  * An immutable {@code SortedSet} that stores its elements in a sorted array.
41 * natural sort ordering of their elements. Either way, null elements are not
61 * two elements are equivalent. Instead, with an explicit comparator, the
62 * following relation determines whether elements {@code x} and {@code y} are
67 * With natural ordering of elements, the following relation determines whether
68 * two elements are equivalent: <pre> {@code
129 * Returns an immutable sorted set containing the given elements sorted by
130 * their natural ordering. When multiple elements are equivalent according to
142 * Returns an immutable sorted set containing the given elements sorted by
143 * their natural ordering. When multiple elements are equivalent according to
155 * Returns an immutable sorted set containing the given elements sorted by
156 * their natural ordering. When multiple elements are equivalent according to
168 * Returns an immutable sorted set containing the given elements sorted by
169 * their natural ordering. When multiple elements are equivalent according to
181 * Returns an immutable sorted set containing the given elements sorted by
182 * their natural ordering. When multiple elements are equivalent according to
201 * Returns an immutable sorted set containing the given elements sorted by
202 * their natural ordering. When multiple elements are equivalent according to
205 * @throws NullPointerException if any of {@code elements} is null
209 E[] elements) {
210 return copyOf(Ordering.natural(), Arrays.asList(elements));
214 * Returns an immutable sorted set containing the given elements sorted by
215 * their natural ordering. When multiple elements are equivalent according to
218 * #copyOfSorted} instead. This method iterates over {@code elements} at most
233 * <p>This method is not type-safe, as it may be called on elements that are
236 * @throws ClassCastException if the elements are not mutually comparable
237 * @throws NullPointerException if any of {@code elements} is null
240 Iterable<? extends E> elements) {
245 return copyOf(naturalOrder, elements);
249 * Returns an immutable sorted set containing the given elements sorted by
250 * their natural ordering. When multiple elements are equivalent according to
253 * {@link #copyOfSorted} instead. This method iterates over {@code elements}
263 * <p><b>Note:</b> Despite what the method name suggests, if {@code elements}
266 * <p>This method is not type-safe, as it may be called on elements that are
269 * <p>This method is safe to use even when {@code elements} is a synchronized
273 * @throws ClassCastException if the elements are not mutually comparable
274 * @throws NullPointerException if any of {@code elements} is null
278 Collection<? extends E> elements) {
283 return copyOf(naturalOrder, elements);
287 * Returns an immutable sorted set containing the given elements sorted by
288 * their natural ordering. When multiple elements are equivalent according to
291 * <p>This method is not type-safe, as it may be called on elements that are
294 * @throws ClassCastException if the elements are not mutually comparable
295 * @throws NullPointerException if any of {@code elements} is null
298 Iterator<? extends E> elements) {
303 return copyOfInternal(naturalOrder, elements);
307 * Returns an immutable sorted set containing the given elements sorted by
308 * the given {@code Comparator}. When multiple elements are equivalent
313 * {@code elements} is null
316 Comparator<? super E> comparator, Iterator<? extends E> elements) {
318 return copyOfInternal(comparator, elements);
322 * Returns an immutable sorted set containing the given elements sorted by
323 * the given {@code Comparator}. When multiple elements are equivalent
325 * included. This method iterates over {@code elements} at most once.
332 * elements} is null
335 Comparator<? super E> comparator, Iterable<? extends E> elements) {
337 return copyOfInternal(comparator, elements);
341 * Returns an immutable sorted set containing the given elements sorted by
342 * the given {@code Comparator}. When multiple elements are equivalent
350 * <p>This method is safe to use even when {@code elements} is a synchronized
355 * {@code elements} is null
359 Comparator<? super E> comparator, Collection<? extends E> elements) {
361 return copyOfInternal(comparator, elements);
365 * Returns an immutable sorted set containing the elements of a sorted set,
368 * elements.
378 * @throws NullPointerException if {@code sortedSet} or any of its elements
391 Comparator<? super E> comparator, Iterable<? extends E> elements) {
393 SortedIterables.hasSameComparator(comparator, elements);
395 if (hasSameComparator && (elements instanceof ImmutableSortedSet)) {
397 ImmutableSortedSet<E> original = (ImmutableSortedSet<E>) elements;
403 SortedIterables.sortedUnique(comparator, elements));
410 Comparator<? super E> comparator, Iterator<? extends E> elements) {
412 ImmutableList.copyOf(SortedIterables.sortedUnique(comparator, elements));
431 * Returns a builder that creates immutable sorted sets whose elements are
444 * Returns a builder that creates immutable sorted sets whose elements are
503 * Adds each element of {@code elements} to the {@code ImmutableSortedSet},
504 * ignoring duplicate elements (only the first duplicate element is added).
506 * @param elements the elements to add
508 * @throws NullPointerException if {@code elements} contains a null element
510 @Override public Builder<E> add(E... elements) {
511 super.add(elements);
516 * Adds each element of {@code elements} to the {@code ImmutableSortedSet},
517 * ignoring duplicate elements (only the first duplicate element is added).
519 * @param elements the elements to add to the {@code ImmutableSortedSet}
521 * @throws NullPointerException if {@code elements} contains a null element
523 @Override public Builder<E> addAll(Iterable<? extends E> elements) {
524 super.addAll(elements);
529 * Adds each element of {@code elements} to the {@code ImmutableSortedSet},
530 * ignoring duplicate elements (only the first duplicate element is added).
532 * @param elements the elements to add to the {@code ImmutableSortedSet}
534 * @throws NullPointerException if {@code elements} contains a null element
536 @Override public Builder<E> addAll(Iterator<? extends E> elements) {
537 super.addAll(elements);
571 * Returns the comparator that orders the elements, which is
573 * elements is used. Note that its behavior is not consistent with
675 final Object[] elements;
677 public SerializedForm(Comparator<? super E> comparator, Object[] elements) {
679 this.elements = elements;
684 return new Builder<E>(comparator).add((E[]) elements).build();