src/share/classes/sun/awt/util/IdentityLinkedList.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:

*** 278,288 **** modCount++; Entry<E> successor = (index==size ? header : entry(index)); Entry<E> predecessor = successor.previous; for (int i=0; i<numNew; i++) { ! Entry<E> e = new Entry<E>((E)a[i], successor, predecessor); predecessor.next = e; predecessor = e; } successor.previous = predecessor; --- 278,290 ---- modCount++; Entry<E> successor = (index==size ? header : entry(index)); Entry<E> predecessor = successor.previous; for (int i=0; i<numNew; i++) { ! @SuppressWarnings("unchecked") ! E tmp = (E) a[i]; ! Entry<E> e = new Entry<E>(tmp, successor, predecessor); predecessor.next = e; predecessor = e; } successor.previous = predecessor;
*** 394,404 **** * @return the index of the first occurrence of the specified element in * this list, or -1 if this list does not contain the element */ public int indexOf(Object o) { int index = 0; ! for (Entry e = header.next; e != header; e = e.next) { if (o == e.element) { return index; } index++; } --- 396,406 ---- * @return the index of the first occurrence of the specified element in * this list, or -1 if this list does not contain the element */ public int indexOf(Object o) { int index = 0; ! for (Entry<E> e = header.next; e != header; e = e.next) { if (o == e.element) { return index; } index++; }
*** 416,426 **** * @return the index of the last occurrence of the specified element in * this list, or -1 if this list does not contain the element */ public int lastIndexOf(Object o) { int index = size; ! for (Entry e = header.previous; e != header; e = e.previous) { index--; if (o == e.element) { return index; } } --- 418,428 ---- * @return the index of the last occurrence of the specified element in * this list, or -1 if this list does not contain the element */ public int lastIndexOf(Object o) { int index = size; ! for (Entry<E> e = header.previous; e != header; e = e.previous) { index--; if (o == e.element) { return index; } }
*** 785,795 **** public Iterator<E> descendingIterator() { return new DescendingIterator(); } /** Adapter to provide descending iterators via ListItr.previous */ ! private class DescendingIterator implements Iterator { final ListItr itr = new ListItr(size()); public boolean hasNext() { return itr.hasPrevious(); } public E next() { --- 787,797 ---- public Iterator<E> descendingIterator() { return new DescendingIterator(); } /** Adapter to provide descending iterators via ListItr.previous */ ! private class DescendingIterator implements Iterator<E> { final ListItr itr = new ListItr(size()); public boolean hasNext() { return itr.hasPrevious(); } public E next() {
*** 858,867 **** --- 860,870 ---- * @throws ArrayStoreException if the runtime type of the specified array * is not a supertype of the runtime type of every element in * this list * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), size); int i = 0;