1.1 --- a/emul/compact/src/main/java/java/util/Deque.java Tue Feb 26 14:55:55 2013 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,584 +0,0 @@
1.4 -/*
1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.6 - *
1.7 - * This code is free software; you can redistribute it and/or modify it
1.8 - * under the terms of the GNU General Public License version 2 only, as
1.9 - * published by the Free Software Foundation. Oracle designates this
1.10 - * particular file as subject to the "Classpath" exception as provided
1.11 - * by Oracle in the LICENSE file that accompanied this code.
1.12 - *
1.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
1.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.15 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.16 - * version 2 for more details (a copy is included in the LICENSE file that
1.17 - * accompanied this code).
1.18 - *
1.19 - * You should have received a copy of the GNU General Public License version
1.20 - * 2 along with this work; if not, write to the Free Software Foundation,
1.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.22 - *
1.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.24 - * or visit www.oracle.com if you need additional information or have any
1.25 - * questions.
1.26 - */
1.27 -
1.28 -/*
1.29 - * This file is available under and governed by the GNU General Public
1.30 - * License version 2 only, as published by the Free Software Foundation.
1.31 - * However, the following notice accompanied the original version of this
1.32 - * file:
1.33 - *
1.34 - * Written by Doug Lea and Josh Bloch with assistance from members of
1.35 - * JCP JSR-166 Expert Group and released to the public domain, as explained
1.36 - * at http://creativecommons.org/publicdomain/zero/1.0/
1.37 - */
1.38 -
1.39 -package java.util;
1.40 -
1.41 -/**
1.42 - * A linear collection that supports element insertion and removal at
1.43 - * both ends. The name <i>deque</i> is short for "double ended queue"
1.44 - * and is usually pronounced "deck". Most <tt>Deque</tt>
1.45 - * implementations place no fixed limits on the number of elements
1.46 - * they may contain, but this interface supports capacity-restricted
1.47 - * deques as well as those with no fixed size limit.
1.48 - *
1.49 - * <p>This interface defines methods to access the elements at both
1.50 - * ends of the deque. Methods are provided to insert, remove, and
1.51 - * examine the element. Each of these methods exists in two forms:
1.52 - * one throws an exception if the operation fails, the other returns a
1.53 - * special value (either <tt>null</tt> or <tt>false</tt>, depending on
1.54 - * the operation). The latter form of the insert operation is
1.55 - * designed specifically for use with capacity-restricted
1.56 - * <tt>Deque</tt> implementations; in most implementations, insert
1.57 - * operations cannot fail.
1.58 - *
1.59 - * <p>The twelve methods described above are summarized in the
1.60 - * following table:
1.61 - *
1.62 - * <p>
1.63 - * <table BORDER CELLPADDING=3 CELLSPACING=1>
1.64 - * <tr>
1.65 - * <td></td>
1.66 - * <td ALIGN=CENTER COLSPAN = 2> <b>First Element (Head)</b></td>
1.67 - * <td ALIGN=CENTER COLSPAN = 2> <b>Last Element (Tail)</b></td>
1.68 - * </tr>
1.69 - * <tr>
1.70 - * <td></td>
1.71 - * <td ALIGN=CENTER><em>Throws exception</em></td>
1.72 - * <td ALIGN=CENTER><em>Special value</em></td>
1.73 - * <td ALIGN=CENTER><em>Throws exception</em></td>
1.74 - * <td ALIGN=CENTER><em>Special value</em></td>
1.75 - * </tr>
1.76 - * <tr>
1.77 - * <td><b>Insert</b></td>
1.78 - * <td>{@link #addFirst addFirst(e)}</td>
1.79 - * <td>{@link #offerFirst offerFirst(e)}</td>
1.80 - * <td>{@link #addLast addLast(e)}</td>
1.81 - * <td>{@link #offerLast offerLast(e)}</td>
1.82 - * </tr>
1.83 - * <tr>
1.84 - * <td><b>Remove</b></td>
1.85 - * <td>{@link #removeFirst removeFirst()}</td>
1.86 - * <td>{@link #pollFirst pollFirst()}</td>
1.87 - * <td>{@link #removeLast removeLast()}</td>
1.88 - * <td>{@link #pollLast pollLast()}</td>
1.89 - * </tr>
1.90 - * <tr>
1.91 - * <td><b>Examine</b></td>
1.92 - * <td>{@link #getFirst getFirst()}</td>
1.93 - * <td>{@link #peekFirst peekFirst()}</td>
1.94 - * <td>{@link #getLast getLast()}</td>
1.95 - * <td>{@link #peekLast peekLast()}</td>
1.96 - * </tr>
1.97 - * </table>
1.98 - *
1.99 - * <p>This interface extends the {@link Queue} interface. When a deque is
1.100 - * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are
1.101 - * added at the end of the deque and removed from the beginning. The methods
1.102 - * inherited from the <tt>Queue</tt> interface are precisely equivalent to
1.103 - * <tt>Deque</tt> methods as indicated in the following table:
1.104 - *
1.105 - * <p>
1.106 - * <table BORDER CELLPADDING=3 CELLSPACING=1>
1.107 - * <tr>
1.108 - * <td ALIGN=CENTER> <b><tt>Queue</tt> Method</b></td>
1.109 - * <td ALIGN=CENTER> <b>Equivalent <tt>Deque</tt> Method</b></td>
1.110 - * </tr>
1.111 - * <tr>
1.112 - * <td>{@link java.util.Queue#add add(e)}</td>
1.113 - * <td>{@link #addLast addLast(e)}</td>
1.114 - * </tr>
1.115 - * <tr>
1.116 - * <td>{@link java.util.Queue#offer offer(e)}</td>
1.117 - * <td>{@link #offerLast offerLast(e)}</td>
1.118 - * </tr>
1.119 - * <tr>
1.120 - * <td>{@link java.util.Queue#remove remove()}</td>
1.121 - * <td>{@link #removeFirst removeFirst()}</td>
1.122 - * </tr>
1.123 - * <tr>
1.124 - * <td>{@link java.util.Queue#poll poll()}</td>
1.125 - * <td>{@link #pollFirst pollFirst()}</td>
1.126 - * </tr>
1.127 - * <tr>
1.128 - * <td>{@link java.util.Queue#element element()}</td>
1.129 - * <td>{@link #getFirst getFirst()}</td>
1.130 - * </tr>
1.131 - * <tr>
1.132 - * <td>{@link java.util.Queue#peek peek()}</td>
1.133 - * <td>{@link #peek peekFirst()}</td>
1.134 - * </tr>
1.135 - * </table>
1.136 - *
1.137 - * <p>Deques can also be used as LIFO (Last-In-First-Out) stacks. This
1.138 - * interface should be used in preference to the legacy {@link Stack} class.
1.139 - * When a deque is used as a stack, elements are pushed and popped from the
1.140 - * beginning of the deque. Stack methods are precisely equivalent to
1.141 - * <tt>Deque</tt> methods as indicated in the table below:
1.142 - *
1.143 - * <p>
1.144 - * <table BORDER CELLPADDING=3 CELLSPACING=1>
1.145 - * <tr>
1.146 - * <td ALIGN=CENTER> <b>Stack Method</b></td>
1.147 - * <td ALIGN=CENTER> <b>Equivalent <tt>Deque</tt> Method</b></td>
1.148 - * </tr>
1.149 - * <tr>
1.150 - * <td>{@link #push push(e)}</td>
1.151 - * <td>{@link #addFirst addFirst(e)}</td>
1.152 - * </tr>
1.153 - * <tr>
1.154 - * <td>{@link #pop pop()}</td>
1.155 - * <td>{@link #removeFirst removeFirst()}</td>
1.156 - * </tr>
1.157 - * <tr>
1.158 - * <td>{@link #peek peek()}</td>
1.159 - * <td>{@link #peekFirst peekFirst()}</td>
1.160 - * </tr>
1.161 - * </table>
1.162 - *
1.163 - * <p>Note that the {@link #peek peek} method works equally well when
1.164 - * a deque is used as a queue or a stack; in either case, elements are
1.165 - * drawn from the beginning of the deque.
1.166 - *
1.167 - * <p>This interface provides two methods to remove interior
1.168 - * elements, {@link #removeFirstOccurrence removeFirstOccurrence} and
1.169 - * {@link #removeLastOccurrence removeLastOccurrence}.
1.170 - *
1.171 - * <p>Unlike the {@link List} interface, this interface does not
1.172 - * provide support for indexed access to elements.
1.173 - *
1.174 - * <p>While <tt>Deque</tt> implementations are not strictly required
1.175 - * to prohibit the insertion of null elements, they are strongly
1.176 - * encouraged to do so. Users of any <tt>Deque</tt> implementations
1.177 - * that do allow null elements are strongly encouraged <i>not</i> to
1.178 - * take advantage of the ability to insert nulls. This is so because
1.179 - * <tt>null</tt> is used as a special return value by various methods
1.180 - * to indicated that the deque is empty.
1.181 - *
1.182 - * <p><tt>Deque</tt> implementations generally do not define
1.183 - * element-based versions of the <tt>equals</tt> and <tt>hashCode</tt>
1.184 - * methods, but instead inherit the identity-based versions from class
1.185 - * <tt>Object</tt>.
1.186 - *
1.187 - * <p>This interface is a member of the <a
1.188 - * href="{@docRoot}/../technotes/guides/collections/index.html"> Java Collections
1.189 - * Framework</a>.
1.190 - *
1.191 - * @author Doug Lea
1.192 - * @author Josh Bloch
1.193 - * @since 1.6
1.194 - * @param <E> the type of elements held in this collection
1.195 - */
1.196 -
1.197 -public interface Deque<E> extends Queue<E> {
1.198 - /**
1.199 - * Inserts the specified element at the front of this deque if it is
1.200 - * possible to do so immediately without violating capacity restrictions.
1.201 - * When using a capacity-restricted deque, it is generally preferable to
1.202 - * use method {@link #offerFirst}.
1.203 - *
1.204 - * @param e the element to add
1.205 - * @throws IllegalStateException if the element cannot be added at this
1.206 - * time due to capacity restrictions
1.207 - * @throws ClassCastException if the class of the specified element
1.208 - * prevents it from being added to this deque
1.209 - * @throws NullPointerException if the specified element is null and this
1.210 - * deque does not permit null elements
1.211 - * @throws IllegalArgumentException if some property of the specified
1.212 - * element prevents it from being added to this deque
1.213 - */
1.214 - void addFirst(E e);
1.215 -
1.216 - /**
1.217 - * Inserts the specified element at the end of this deque if it is
1.218 - * possible to do so immediately without violating capacity restrictions.
1.219 - * When using a capacity-restricted deque, it is generally preferable to
1.220 - * use method {@link #offerLast}.
1.221 - *
1.222 - * <p>This method is equivalent to {@link #add}.
1.223 - *
1.224 - * @param e the element to add
1.225 - * @throws IllegalStateException if the element cannot be added at this
1.226 - * time due to capacity restrictions
1.227 - * @throws ClassCastException if the class of the specified element
1.228 - * prevents it from being added to this deque
1.229 - * @throws NullPointerException if the specified element is null and this
1.230 - * deque does not permit null elements
1.231 - * @throws IllegalArgumentException if some property of the specified
1.232 - * element prevents it from being added to this deque
1.233 - */
1.234 - void addLast(E e);
1.235 -
1.236 - /**
1.237 - * Inserts the specified element at the front of this deque unless it would
1.238 - * violate capacity restrictions. When using a capacity-restricted deque,
1.239 - * this method is generally preferable to the {@link #addFirst} method,
1.240 - * which can fail to insert an element only by throwing an exception.
1.241 - *
1.242 - * @param e the element to add
1.243 - * @return <tt>true</tt> if the element was added to this deque, else
1.244 - * <tt>false</tt>
1.245 - * @throws ClassCastException if the class of the specified element
1.246 - * prevents it from being added to this deque
1.247 - * @throws NullPointerException if the specified element is null and this
1.248 - * deque does not permit null elements
1.249 - * @throws IllegalArgumentException if some property of the specified
1.250 - * element prevents it from being added to this deque
1.251 - */
1.252 - boolean offerFirst(E e);
1.253 -
1.254 - /**
1.255 - * Inserts the specified element at the end of this deque unless it would
1.256 - * violate capacity restrictions. When using a capacity-restricted deque,
1.257 - * this method is generally preferable to the {@link #addLast} method,
1.258 - * which can fail to insert an element only by throwing an exception.
1.259 - *
1.260 - * @param e the element to add
1.261 - * @return <tt>true</tt> if the element was added to this deque, else
1.262 - * <tt>false</tt>
1.263 - * @throws ClassCastException if the class of the specified element
1.264 - * prevents it from being added to this deque
1.265 - * @throws NullPointerException if the specified element is null and this
1.266 - * deque does not permit null elements
1.267 - * @throws IllegalArgumentException if some property of the specified
1.268 - * element prevents it from being added to this deque
1.269 - */
1.270 - boolean offerLast(E e);
1.271 -
1.272 - /**
1.273 - * Retrieves and removes the first element of this deque. This method
1.274 - * differs from {@link #pollFirst pollFirst} only in that it throws an
1.275 - * exception if this deque is empty.
1.276 - *
1.277 - * @return the head of this deque
1.278 - * @throws NoSuchElementException if this deque is empty
1.279 - */
1.280 - E removeFirst();
1.281 -
1.282 - /**
1.283 - * Retrieves and removes the last element of this deque. This method
1.284 - * differs from {@link #pollLast pollLast} only in that it throws an
1.285 - * exception if this deque is empty.
1.286 - *
1.287 - * @return the tail of this deque
1.288 - * @throws NoSuchElementException if this deque is empty
1.289 - */
1.290 - E removeLast();
1.291 -
1.292 - /**
1.293 - * Retrieves and removes the first element of this deque,
1.294 - * or returns <tt>null</tt> if this deque is empty.
1.295 - *
1.296 - * @return the head of this deque, or <tt>null</tt> if this deque is empty
1.297 - */
1.298 - E pollFirst();
1.299 -
1.300 - /**
1.301 - * Retrieves and removes the last element of this deque,
1.302 - * or returns <tt>null</tt> if this deque is empty.
1.303 - *
1.304 - * @return the tail of this deque, or <tt>null</tt> if this deque is empty
1.305 - */
1.306 - E pollLast();
1.307 -
1.308 - /**
1.309 - * Retrieves, but does not remove, the first element of this deque.
1.310 - *
1.311 - * This method differs from {@link #peekFirst peekFirst} only in that it
1.312 - * throws an exception if this deque is empty.
1.313 - *
1.314 - * @return the head of this deque
1.315 - * @throws NoSuchElementException if this deque is empty
1.316 - */
1.317 - E getFirst();
1.318 -
1.319 - /**
1.320 - * Retrieves, but does not remove, the last element of this deque.
1.321 - * This method differs from {@link #peekLast peekLast} only in that it
1.322 - * throws an exception if this deque is empty.
1.323 - *
1.324 - * @return the tail of this deque
1.325 - * @throws NoSuchElementException if this deque is empty
1.326 - */
1.327 - E getLast();
1.328 -
1.329 - /**
1.330 - * Retrieves, but does not remove, the first element of this deque,
1.331 - * or returns <tt>null</tt> if this deque is empty.
1.332 - *
1.333 - * @return the head of this deque, or <tt>null</tt> if this deque is empty
1.334 - */
1.335 - E peekFirst();
1.336 -
1.337 - /**
1.338 - * Retrieves, but does not remove, the last element of this deque,
1.339 - * or returns <tt>null</tt> if this deque is empty.
1.340 - *
1.341 - * @return the tail of this deque, or <tt>null</tt> if this deque is empty
1.342 - */
1.343 - E peekLast();
1.344 -
1.345 - /**
1.346 - * Removes the first occurrence of the specified element from this deque.
1.347 - * If the deque does not contain the element, it is unchanged.
1.348 - * More formally, removes the first element <tt>e</tt> such that
1.349 - * <tt>(o==null ? e==null : o.equals(e))</tt>
1.350 - * (if such an element exists).
1.351 - * Returns <tt>true</tt> if this deque contained the specified element
1.352 - * (or equivalently, if this deque changed as a result of the call).
1.353 - *
1.354 - * @param o element to be removed from this deque, if present
1.355 - * @return <tt>true</tt> if an element was removed as a result of this call
1.356 - * @throws ClassCastException if the class of the specified element
1.357 - * is incompatible with this deque
1.358 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.359 - * @throws NullPointerException if the specified element is null and this
1.360 - * deque does not permit null elements
1.361 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.362 - */
1.363 - boolean removeFirstOccurrence(Object o);
1.364 -
1.365 - /**
1.366 - * Removes the last occurrence of the specified element from this deque.
1.367 - * If the deque does not contain the element, it is unchanged.
1.368 - * More formally, removes the last element <tt>e</tt> such that
1.369 - * <tt>(o==null ? e==null : o.equals(e))</tt>
1.370 - * (if such an element exists).
1.371 - * Returns <tt>true</tt> if this deque contained the specified element
1.372 - * (or equivalently, if this deque changed as a result of the call).
1.373 - *
1.374 - * @param o element to be removed from this deque, if present
1.375 - * @return <tt>true</tt> if an element was removed as a result of this call
1.376 - * @throws ClassCastException if the class of the specified element
1.377 - * is incompatible with this deque
1.378 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.379 - * @throws NullPointerException if the specified element is null and this
1.380 - * deque does not permit null elements
1.381 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.382 - */
1.383 - boolean removeLastOccurrence(Object o);
1.384 -
1.385 - // *** Queue methods ***
1.386 -
1.387 - /**
1.388 - * Inserts the specified element into the queue represented by this deque
1.389 - * (in other words, at the tail of this deque) if it is possible to do so
1.390 - * immediately without violating capacity restrictions, returning
1.391 - * <tt>true</tt> upon success and throwing an
1.392 - * <tt>IllegalStateException</tt> if no space is currently available.
1.393 - * When using a capacity-restricted deque, it is generally preferable to
1.394 - * use {@link #offer(Object) offer}.
1.395 - *
1.396 - * <p>This method is equivalent to {@link #addLast}.
1.397 - *
1.398 - * @param e the element to add
1.399 - * @return <tt>true</tt> (as specified by {@link Collection#add})
1.400 - * @throws IllegalStateException if the element cannot be added at this
1.401 - * time due to capacity restrictions
1.402 - * @throws ClassCastException if the class of the specified element
1.403 - * prevents it from being added to this deque
1.404 - * @throws NullPointerException if the specified element is null and this
1.405 - * deque does not permit null elements
1.406 - * @throws IllegalArgumentException if some property of the specified
1.407 - * element prevents it from being added to this deque
1.408 - */
1.409 - boolean add(E e);
1.410 -
1.411 - /**
1.412 - * Inserts the specified element into the queue represented by this deque
1.413 - * (in other words, at the tail of this deque) if it is possible to do so
1.414 - * immediately without violating capacity restrictions, returning
1.415 - * <tt>true</tt> upon success and <tt>false</tt> if no space is currently
1.416 - * available. When using a capacity-restricted deque, this method is
1.417 - * generally preferable to the {@link #add} method, which can fail to
1.418 - * insert an element only by throwing an exception.
1.419 - *
1.420 - * <p>This method is equivalent to {@link #offerLast}.
1.421 - *
1.422 - * @param e the element to add
1.423 - * @return <tt>true</tt> if the element was added to this deque, else
1.424 - * <tt>false</tt>
1.425 - * @throws ClassCastException if the class of the specified element
1.426 - * prevents it from being added to this deque
1.427 - * @throws NullPointerException if the specified element is null and this
1.428 - * deque does not permit null elements
1.429 - * @throws IllegalArgumentException if some property of the specified
1.430 - * element prevents it from being added to this deque
1.431 - */
1.432 - boolean offer(E e);
1.433 -
1.434 - /**
1.435 - * Retrieves and removes the head of the queue represented by this deque
1.436 - * (in other words, the first element of this deque).
1.437 - * This method differs from {@link #poll poll} only in that it throws an
1.438 - * exception if this deque is empty.
1.439 - *
1.440 - * <p>This method is equivalent to {@link #removeFirst()}.
1.441 - *
1.442 - * @return the head of the queue represented by this deque
1.443 - * @throws NoSuchElementException if this deque is empty
1.444 - */
1.445 - E remove();
1.446 -
1.447 - /**
1.448 - * Retrieves and removes the head of the queue represented by this deque
1.449 - * (in other words, the first element of this deque), or returns
1.450 - * <tt>null</tt> if this deque is empty.
1.451 - *
1.452 - * <p>This method is equivalent to {@link #pollFirst()}.
1.453 - *
1.454 - * @return the first element of this deque, or <tt>null</tt> if
1.455 - * this deque is empty
1.456 - */
1.457 - E poll();
1.458 -
1.459 - /**
1.460 - * Retrieves, but does not remove, the head of the queue represented by
1.461 - * this deque (in other words, the first element of this deque).
1.462 - * This method differs from {@link #peek peek} only in that it throws an
1.463 - * exception if this deque is empty.
1.464 - *
1.465 - * <p>This method is equivalent to {@link #getFirst()}.
1.466 - *
1.467 - * @return the head of the queue represented by this deque
1.468 - * @throws NoSuchElementException if this deque is empty
1.469 - */
1.470 - E element();
1.471 -
1.472 - /**
1.473 - * Retrieves, but does not remove, the head of the queue represented by
1.474 - * this deque (in other words, the first element of this deque), or
1.475 - * returns <tt>null</tt> if this deque is empty.
1.476 - *
1.477 - * <p>This method is equivalent to {@link #peekFirst()}.
1.478 - *
1.479 - * @return the head of the queue represented by this deque, or
1.480 - * <tt>null</tt> if this deque is empty
1.481 - */
1.482 - E peek();
1.483 -
1.484 -
1.485 - // *** Stack methods ***
1.486 -
1.487 - /**
1.488 - * Pushes an element onto the stack represented by this deque (in other
1.489 - * words, at the head of this deque) if it is possible to do so
1.490 - * immediately without violating capacity restrictions, returning
1.491 - * <tt>true</tt> upon success and throwing an
1.492 - * <tt>IllegalStateException</tt> if no space is currently available.
1.493 - *
1.494 - * <p>This method is equivalent to {@link #addFirst}.
1.495 - *
1.496 - * @param e the element to push
1.497 - * @throws IllegalStateException if the element cannot be added at this
1.498 - * time due to capacity restrictions
1.499 - * @throws ClassCastException if the class of the specified element
1.500 - * prevents it from being added to this deque
1.501 - * @throws NullPointerException if the specified element is null and this
1.502 - * deque does not permit null elements
1.503 - * @throws IllegalArgumentException if some property of the specified
1.504 - * element prevents it from being added to this deque
1.505 - */
1.506 - void push(E e);
1.507 -
1.508 - /**
1.509 - * Pops an element from the stack represented by this deque. In other
1.510 - * words, removes and returns the first element of this deque.
1.511 - *
1.512 - * <p>This method is equivalent to {@link #removeFirst()}.
1.513 - *
1.514 - * @return the element at the front of this deque (which is the top
1.515 - * of the stack represented by this deque)
1.516 - * @throws NoSuchElementException if this deque is empty
1.517 - */
1.518 - E pop();
1.519 -
1.520 -
1.521 - // *** Collection methods ***
1.522 -
1.523 - /**
1.524 - * Removes the first occurrence of the specified element from this deque.
1.525 - * If the deque does not contain the element, it is unchanged.
1.526 - * More formally, removes the first element <tt>e</tt> such that
1.527 - * <tt>(o==null ? e==null : o.equals(e))</tt>
1.528 - * (if such an element exists).
1.529 - * Returns <tt>true</tt> if this deque contained the specified element
1.530 - * (or equivalently, if this deque changed as a result of the call).
1.531 - *
1.532 - * <p>This method is equivalent to {@link #removeFirstOccurrence}.
1.533 - *
1.534 - * @param o element to be removed from this deque, if present
1.535 - * @return <tt>true</tt> if an element was removed as a result of this call
1.536 - * @throws ClassCastException if the class of the specified element
1.537 - * is incompatible with this deque
1.538 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.539 - * @throws NullPointerException if the specified element is null and this
1.540 - * deque does not permit null elements
1.541 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.542 - */
1.543 - boolean remove(Object o);
1.544 -
1.545 - /**
1.546 - * Returns <tt>true</tt> if this deque contains the specified element.
1.547 - * More formally, returns <tt>true</tt> if and only if this deque contains
1.548 - * at least one element <tt>e</tt> such that
1.549 - * <tt>(o==null ? e==null : o.equals(e))</tt>.
1.550 - *
1.551 - * @param o element whose presence in this deque is to be tested
1.552 - * @return <tt>true</tt> if this deque contains the specified element
1.553 - * @throws ClassCastException if the type of the specified element
1.554 - * is incompatible with this deque
1.555 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.556 - * @throws NullPointerException if the specified element is null and this
1.557 - * deque does not permit null elements
1.558 - * (<a href="Collection.html#optional-restrictions">optional</a>)
1.559 - */
1.560 - boolean contains(Object o);
1.561 -
1.562 - /**
1.563 - * Returns the number of elements in this deque.
1.564 - *
1.565 - * @return the number of elements in this deque
1.566 - */
1.567 - public int size();
1.568 -
1.569 - /**
1.570 - * Returns an iterator over the elements in this deque in proper sequence.
1.571 - * The elements will be returned in order from first (head) to last (tail).
1.572 - *
1.573 - * @return an iterator over the elements in this deque in proper sequence
1.574 - */
1.575 - Iterator<E> iterator();
1.576 -
1.577 - /**
1.578 - * Returns an iterator over the elements in this deque in reverse
1.579 - * sequential order. The elements will be returned in order from
1.580 - * last (tail) to first (head).
1.581 - *
1.582 - * @return an iterator over the elements in this deque in reverse
1.583 - * sequence
1.584 - */
1.585 - Iterator<E> descendingIterator();
1.586 -
1.587 -}