Lines Matching refs:elements

61  * <p>All elements are permitted, including <tt>null</tt>.
76 * @param <E> the type of elements held in this collection
111 * Creates a list containing the elements of the specified
115 * @param c the collection of initially held elements
119 Object[] elements = c.toArray();
121 if (elements.getClass() != Object[].class)
122 elements = Arrays.copyOf(elements, elements.length, Object[].class);
123 setArray(elements);
138 * Returns the number of elements in this list.
140 * @return the number of elements in this list
147 * Returns <tt>true</tt> if this list contains no elements.
149 * @return <tt>true</tt> if this list contains no elements
166 * @param elements the array
171 private static int indexOf(Object o, Object[] elements,
175 if (elements[i] == null)
179 if (o.equals(elements[i]))
188 * @param elements the array
192 private static int lastIndexOf(Object o, Object[] elements, int index) {
195 if (elements[i] == null)
199 if (o.equals(elements[i]))
215 Object[] elements = getArray();
216 return indexOf(o, elements, 0, elements.length) >= 0;
223 Object[] elements = getArray();
224 return indexOf(o, elements, 0, elements.length);
243 Object[] elements = getArray();
244 return indexOf(e, elements, index, elements.length);
251 Object[] elements = getArray();
252 return lastIndexOf(o, elements, elements.length - 1);
272 Object[] elements = getArray();
273 return lastIndexOf(e, elements, index);
277 * Returns a shallow copy of this list. (The elements themselves
294 * Returns an array containing all of the elements in this list
304 * @return an array containing all the elements in this list
307 Object[] elements = getArray();
308 return Arrays.copyOf(elements, elements.length);
312 * Returns an array containing all of the elements in this list in
320 * (i.e., the array has more elements than this list), the element in
324 * any null elements.)
341 * @param a the array into which the elements of the list are to
344 * @return an array containing all the elements in this list
352 Object[] elements = getArray();
353 int len = elements.length;
355 return (T[]) Arrays.copyOf(elements, len, a.getClass());
357 System.arraycopy(elements, 0, a, 0, len);
390 Object[] elements = getArray();
391 E oldValue = get(elements, index);
394 int len = elements.length;
395 Object[] newElements = Arrays.copyOf(elements, len);
400 setArray(elements);
418 Object[] elements = getArray();
419 int len = elements.length;
420 Object[] newElements = Arrays.copyOf(elements, len + 1);
432 * any subsequent elements to the right (adds one to their indices).
440 Object[] elements = getArray();
441 int len = elements.length;
448 newElements = Arrays.copyOf(elements, len + 1);
451 System.arraycopy(elements, 0, newElements, 0, index);
452 System.arraycopy(elements, index, newElements, index + 1,
464 * Shifts any subsequent elements to the left (subtracts one from their
473 Object[] elements = getArray();
474 int len = elements.length;
475 E oldValue = get(elements, index);
478 setArray(Arrays.copyOf(elements, len - 1));
481 System.arraycopy(elements, 0, newElements, 0, index);
482 System.arraycopy(elements, index + 1, newElements, index,
509 Object[] elements = getArray();
510 int len = elements.length;
518 if (eq(o, elements[i])) {
521 newElements[k-1] = elements[k];
525 newElements[i] = elements[i];
529 if (eq(o, elements[newlen])) {
541 * Removes from this list all of the elements whose index is between
543 * Shifts any succeeding elements to the left (reduces their index).
544 * This call shortens the list by <tt>(toIndex - fromIndex)</tt> elements.
556 Object[] elements = getArray();
557 int len = elements.length;
564 setArray(Arrays.copyOf(elements, newlen));
567 System.arraycopy(elements, 0, newElements, 0, fromIndex);
568 System.arraycopy(elements, toIndex, newElements,
589 Object[] elements = getArray();
590 int len = elements.length;
593 if (eq(e, elements[i]))
596 newElements[i] = elements[i];
607 * Returns <tt>true</tt> if this list contains all of the elements of the
611 * @return <tt>true</tt> if this list contains all of the elements of the
617 Object[] elements = getArray();
618 int len = elements.length;
620 if (indexOf(e, elements, 0, len) < 0)
627 * Removes from this list all of its elements that are contained in
631 * @param c collection containing elements to be removed from this list
637 * specified collection does not permit null elements
646 Object[] elements = getArray();
647 int len = elements.length;
649 // temp array holds those elements we know we want to keep
653 Object element = elements[i];
669 * Retains only the elements in this list that are contained in the
671 * its elements that are not contained in the specified collection.
673 * @param c collection containing elements to be retained in this list
679 * specified collection does not permit null elements
688 Object[] elements = getArray();
689 int len = elements.length;
691 // temp array holds those elements we know we want to keep
695 Object element = elements[i];
711 * Appends all of the elements in the specified collection that
716 * @param c collection containing elements to be added to this list
717 * @return the number of elements added
729 Object[] elements = getArray();
730 int len = elements.length;
734 if (indexOf(e, elements, 0, len) < 0 &&
739 Object[] newElements = Arrays.copyOf(elements, len + added);
750 * Removes all of the elements from this list.
764 * Appends all of the elements in the specified collection to the end
768 * @param c collection containing elements to be added to this list
780 Object[] elements = getArray();
781 int len = elements.length;
782 Object[] newElements = Arrays.copyOf(elements, len + cs.length);
792 * Inserts all of the elements in the specified collection into this
794 * currently at that position (if any) and any subsequent elements to
795 * the right (increases their indices). The new elements will appear
801 * @param c collection containing elements to be added to this list
812 Object[] elements = getArray();
813 int len = elements.length;
822 newElements = Arrays.copyOf(elements, len + cs.length);
825 System.arraycopy(elements, 0, newElements, 0, index);
826 System.arraycopy(elements, index,
842 * (int), followed by all of its elements (each an Object)
851 Object[] elements = getArray();
853 s.writeInt(elements.length);
855 // Write out all elements in the proper order.
856 for (Object element : elements)
875 Object[] elements = new Object[len];
877 // Read in all elements in the proper order.
879 elements[i] = s.readObject();
880 setArray(elements);
886 * elements in the order they are returned by its iterator, enclosed in
887 * square brackets (<tt>"[]"</tt>). Adjacent elements are separated by
901 * of elements returned by an {@linkplain List#iterator() iterator}
905 * elements at the same position in the sequence are <em>equal</em>.
906 * Two elements {@code e1} and {@code e2} are considered
920 Object[] elements = getArray();
921 int len = elements.length;
923 if (!it.hasNext() || !eq(elements[i], it.next()))
939 Object[] elements = getArray();
940 int len = elements.length;
942 Object obj = elements[i];
949 * Returns an iterator over the elements in this list in proper sequence.
956 * @return an iterator over the elements in this list in proper sequence
985 Object[] elements = getArray();
986 int len = elements.length;
990 return new COWIterator<E>(elements, index);
999 private COWIterator(Object[] elements, int initialCursor) {
1001 snapshot = elements;
1081 Object[] elements = getArray();
1082 int len = elements.length;