Lines Matching refs:elements
65 * Returns an immutable set instance containing the given enum elements.
69 * order, not the order in which the elements are provided to the method.
71 * @param anElement one of the elements the set should contain
72 * @param otherElements the rest of the elements the set should contain
73 * @return an immutable set containing those elements, minus duplicates
83 * Returns an immutable set instance containing the given enum elements.
87 * order, not the order in which the elements appear in the given collection.
89 * @param elements the elements, all of the same {@code enum} type, that the
91 * @return an immutable set containing those elements, minus duplicates
96 Iterable<E> elements) {
97 Iterator<E> iterator = elements.iterator();
101 if (elements instanceof EnumSet) {
102 EnumSet<E> enumSetClone = EnumSet.copyOf((EnumSet<E>) elements);
114 * Returns a new {@code EnumSet} instance containing the given elements.
159 * elements in unspecified order.
161 * <p><b>Note:</b> if mutability is not required and the elements are
167 * @param elements the elements that the set should contain
168 * @return a new {@code HashSet} containing those elements (minus duplicates)
170 public static <E> HashSet<E> newHashSet(E... elements) {
171 int capacity = Maps.capacity(elements.length);
173 Collections.addAll(set, elements);
179 * specified number of elements without rehashing.
183 * expectedSize} elements without rehashing
192 * elements in unspecified order.
194 * <p><b>Note:</b> if mutability is not required and the elements are
200 * @param elements the elements that the set should contain
201 * @return a new {@code HashSet} containing those elements (minus duplicates)
203 public static <E> HashSet<E> newHashSet(Iterable<? extends E> elements) {
204 if (elements instanceof Collection) {
206 Collection<? extends E> collection = (Collection<? extends E>) elements;
209 return newHashSet(elements.iterator());
215 * elements in unspecified order.
217 * <p><b>Note:</b> if mutability is not required and the elements are
223 * @param elements the elements that the set should contain
224 * @return a new {@code HashSet} containing those elements (minus duplicates)
226 public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) {
228 while (elements.hasNext()) {
229 set.add(elements.next());
250 * given elements in order.
252 * <p><b>Note:</b> if mutability is not required and the elements are
255 * @param elements the elements that the set should contain, in order
256 * @return a new {@code LinkedHashSet} containing those elements (minus
260 Iterable<? extends E> elements) {
261 if (elements instanceof Collection) {
263 Collection<? extends E> collection = (Collection<? extends E>) elements;
267 for (E element : elements) {
278 * natural sort ordering of its elements.
292 * elements sorted by their natural ordering.
297 * <p><b>Note:</b> If {@code elements} is a {@code SortedSet} with an explicit
302 * @param elements the elements that the set should contain
303 * @return a new {@code TreeSet} containing those elements (minus duplicates)
307 Iterable<? extends E> elements) {
309 for (E element : elements) {
343 * {@code EnumSet} instance and contains no elements
360 * as the elements are of enum type.
364 * @param type the type of the elements in the set
507 * Does not support null elements.
535 * set contains all elements that are contained in either backing set.
536 * Iterating over the returned set iterates first over all the elements of
586 * returned set contains all elements that are contained by both backing sets.
641 * returned set contains all elements that are contained by {@code set1} and
642 * not contained by {@code set2}. {@code set2} may also contain elements not
676 * Returns the elements of {@code unfiltered} that satisfy a predicate. The
685 * only elements that satisfy the filter will be removed from the underlying
692 * across every element in the underlying set and determine which elements
755 * @param sets the sets to choose elements from, in the order that
756 * the elements chosen from those sets should appear in the resulting
800 * @param sets the sets to choose elements from, in the order that
801 * the elements chosen from those sets should appear in the resulting