1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
8 |
|
package java.util; |
9 |
– |
import java.util.*; // for javadoc (till 6280605 is fixed) |
9 |
|
|
10 |
|
/** |
11 |
|
* Linked list implementation of the <tt>List</tt> interface. Implements all |
59 |
|
* should be used only to detect bugs.</i> |
60 |
|
* |
61 |
|
* <p>This class is a member of the |
62 |
< |
* <a href="{@docRoot}/../guide/collections/index.html"> |
62 |
> |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
63 |
|
* Java Collections Framework</a>. |
64 |
|
* |
65 |
|
* @author Josh Bloch |
509 |
|
* Inserts the specified element at the end of this list. |
510 |
|
* |
511 |
|
* @param e the element to insert |
512 |
< |
* @return <tt>true</tt> (as per the spec for {@link Deque#offerLast}) |
512 |
> |
* @return <tt>true</tt> (as specified by {@link Deque#offerLast}) |
513 |
|
* @since 1.6 |
514 |
|
*/ |
515 |
|
public boolean offerLast(E e) { |
546 |
|
} |
547 |
|
|
548 |
|
/** |
549 |
< |
* Retrieves and removes the first element of this list, or |
550 |
< |
* <tt>null</tt> if this list is empty. |
549 |
> |
* Retrieves and removes the first element of this list, |
550 |
> |
* or returns <tt>null</tt> if this list is empty. |
551 |
|
* |
552 |
|
* @return the first element of this list, or <tt>null</tt> if |
553 |
|
* this list is empty |
560 |
|
} |
561 |
|
|
562 |
|
/** |
563 |
< |
* Retrieves and removes the last element of this list, or |
564 |
< |
* <tt>null</tt> if this list is empty. |
563 |
> |
* Retrieves and removes the last element of this list, |
564 |
> |
* or returns <tt>null</tt> if this list is empty. |
565 |
|
* |
566 |
|
* @return the last element of this list, or <tt>null</tt> if |
567 |
|
* this list is empty |
798 |
|
} |
799 |
|
|
800 |
|
/** |
801 |
+ |
* @since 1.6 |
802 |
+ |
*/ |
803 |
+ |
public Iterator<E> descendingIterator() { |
804 |
+ |
return new DescendingIterator(); |
805 |
+ |
} |
806 |
+ |
|
807 |
+ |
/** Adapter to provide descending iterators via ListItr.previous */ |
808 |
+ |
private class DescendingIterator implements Iterator { |
809 |
+ |
final ListItr itr = new ListItr(size()); |
810 |
+ |
public boolean hasNext() { |
811 |
+ |
return itr.hasPrevious(); |
812 |
+ |
} |
813 |
+ |
public E next() { |
814 |
+ |
return itr.previous(); |
815 |
+ |
} |
816 |
+ |
public void remove() { |
817 |
+ |
itr.remove(); |
818 |
+ |
} |
819 |
+ |
} |
820 |
+ |
|
821 |
+ |
/** |
822 |
|
* Returns a shallow copy of this <tt>LinkedList</tt>. (The elements |
823 |
|
* themselves are not cloned.) |
824 |
|
* |