1 |
|
/* |
2 |
< |
* %W% %E% |
2 |
> |
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. |
3 |
> |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
< |
* Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
6 |
< |
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
5 |
> |
* This code is free software; you can redistribute it and/or modify it |
6 |
> |
* under the terms of the GNU General Public License version 2 only, as |
7 |
> |
* published by the Free Software Foundation. Sun designates this |
8 |
> |
* particular file as subject to the "Classpath" exception as provided |
9 |
> |
* by Sun in the LICENSE file that accompanied this code. |
10 |
> |
* |
11 |
> |
* This code is distributed in the hope that it will be useful, but WITHOUT |
12 |
> |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 |
> |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 |
> |
* version 2 for more details (a copy is included in the LICENSE file that |
15 |
> |
* accompanied this code). |
16 |
> |
* |
17 |
> |
* You should have received a copy of the GNU General Public License version |
18 |
> |
* 2 along with this work; if not, write to the Free Software Foundation, |
19 |
> |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
> |
* |
21 |
> |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 |
> |
* CA 95054 USA or visit www.sun.com if you need additional information or |
23 |
> |
* have any questions. |
24 |
|
*/ |
25 |
|
|
26 |
|
package java.util; |
9 |
– |
import java.util.*; // for javadoc (till 6280605 is fixed) |
27 |
|
|
28 |
|
/** |
29 |
|
* Linked list implementation of the <tt>List</tt> interface. Implements all |
77 |
|
* should be used only to detect bugs.</i> |
78 |
|
* |
79 |
|
* <p>This class is a member of the |
80 |
< |
* <a href="{@docRoot}/../guide/collections/index.html"> |
80 |
> |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
81 |
|
* Java Collections Framework</a>. |
82 |
|
* |
83 |
|
* @author Josh Bloch |
527 |
|
* Inserts the specified element at the end of this list. |
528 |
|
* |
529 |
|
* @param e the element to insert |
530 |
< |
* @return <tt>true</tt> (as per the spec for {@link Deque#offerLast}) |
530 |
> |
* @return <tt>true</tt> (as specified by {@link Deque#offerLast}) |
531 |
|
* @since 1.6 |
532 |
|
*/ |
533 |
|
public boolean offerLast(E e) { |
564 |
|
} |
565 |
|
|
566 |
|
/** |
567 |
< |
* Retrieves and removes the first element of this list, or |
568 |
< |
* <tt>null</tt> if this list is empty. |
567 |
> |
* Retrieves and removes the first element of this list, |
568 |
> |
* or returns <tt>null</tt> if this list is empty. |
569 |
|
* |
570 |
|
* @return the first element of this list, or <tt>null</tt> if |
571 |
|
* this list is empty |
578 |
|
} |
579 |
|
|
580 |
|
/** |
581 |
< |
* Retrieves and removes the last element of this list, or |
582 |
< |
* <tt>null</tt> if this list is empty. |
581 |
> |
* Retrieves and removes the last element of this list, |
582 |
> |
* or returns <tt>null</tt> if this list is empty. |
583 |
|
* |
584 |
|
* @return the last element of this list, or <tt>null</tt> if |
585 |
|
* this list is empty |
816 |
|
} |
817 |
|
|
818 |
|
/** |
819 |
+ |
* @since 1.6 |
820 |
+ |
*/ |
821 |
+ |
public Iterator<E> descendingIterator() { |
822 |
+ |
return new DescendingIterator(); |
823 |
+ |
} |
824 |
+ |
|
825 |
+ |
/** Adapter to provide descending iterators via ListItr.previous */ |
826 |
+ |
private class DescendingIterator implements Iterator { |
827 |
+ |
final ListItr itr = new ListItr(size()); |
828 |
+ |
public boolean hasNext() { |
829 |
+ |
return itr.hasPrevious(); |
830 |
+ |
} |
831 |
+ |
public E next() { |
832 |
+ |
return itr.previous(); |
833 |
+ |
} |
834 |
+ |
public void remove() { |
835 |
+ |
itr.remove(); |
836 |
+ |
} |
837 |
+ |
} |
838 |
+ |
|
839 |
+ |
/** |
840 |
|
* Returns a shallow copy of this <tt>LinkedList</tt>. (The elements |
841 |
|
* themselves are not cloned.) |
842 |
|
* |