1 |
|
/* |
2 |
|
* Written by Josh Bloch of Google Inc. and released to the public domain, |
3 |
< |
* as explained at http://creativecommons.org/licenses/publicdomain. |
3 |
> |
* as explained at http://creativecommons.org/publicdomain/zero/1.0/. |
4 |
|
*/ |
5 |
|
|
6 |
|
package java.util; |
7 |
– |
import java.io.*; |
7 |
|
|
8 |
|
/** |
9 |
|
* Resizable-array implementation of the {@link Deque} interface. Array |
51 |
|
* @param <E> the type of elements held in this collection |
52 |
|
*/ |
53 |
|
public class ArrayDeque<E> extends AbstractCollection<E> |
54 |
< |
implements Deque<E>, Cloneable, Serializable |
54 |
> |
implements Deque<E>, Cloneable, java.io.Serializable |
55 |
|
{ |
56 |
|
/** |
57 |
|
* The array in which the elements of the deque are stored. |
748 |
|
* The following code can be used to dump the deque into a newly |
749 |
|
* allocated array of <tt>String</tt>: |
750 |
|
* |
751 |
< |
* <pre> |
753 |
< |
* String[] y = x.toArray(new String[0]);</pre> |
751 |
> |
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre> |
752 |
|
* |
753 |
|
* Note that <tt>toArray(new Object[0])</tt> is identical in function to |
754 |
|
* <tt>toArray()</tt>. |
803 |
|
* followed by all of its elements (each an object reference) in |
804 |
|
* first-to-last order. |
805 |
|
*/ |
806 |
< |
private void writeObject(ObjectOutputStream s) throws IOException { |
806 |
> |
private void writeObject(java.io.ObjectOutputStream s) |
807 |
> |
throws java.io.IOException { |
808 |
|
s.defaultWriteObject(); |
809 |
|
|
810 |
|
// Write out size |
819 |
|
/** |
820 |
|
* Deserialize this deque. |
821 |
|
*/ |
822 |
< |
private void readObject(ObjectInputStream s) |
823 |
< |
throws IOException, ClassNotFoundException { |
822 |
> |
private void readObject(java.io.ObjectInputStream s) |
823 |
> |
throws java.io.IOException, ClassNotFoundException { |
824 |
|
s.defaultReadObject(); |
825 |
|
|
826 |
|
// Read in size and allocate array |