16232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson/* 26232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Written by Doug Lea with assistance from members of JCP JSR-166 36232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Expert Group and released to the public domain, as explained at 4a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * http://creativecommons.org/publicdomain/zero/1.0/ 56232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 66232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 76232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilsonpackage java.util.concurrent; 8edf43d27e240d82106f39ae91404963c23987234Narayan Kamath 9e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniakimport java.util.Deque; 10e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniakimport java.util.Iterator; 11e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniakimport java.util.NoSuchElementException; 12e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak 13e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak// BEGIN android-note 14e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak// fixed framework docs link to "Collection#optional" 15e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak// END android-note 166232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 176232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson/** 186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * A {@link Deque} that additionally supports blocking operations that wait 196232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * for the deque to become non-empty when retrieving an element, and wait for 206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * space to become available in the deque when storing an element. 216232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2291770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * <p>{@code BlockingDeque} methods come in four forms, with different ways 236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * of handling operations that cannot be satisfied immediately, but may be 246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * satisfied at some point in the future: 256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * one throws an exception, the second returns a special value (either 2691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code null} or {@code false}, depending on the operation), the third 276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * blocks the current thread indefinitely until the operation can succeed, 286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * and the fourth blocks for only a given maximum time limit before giving 296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * up. These methods are summarized in the following table: 306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 316232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <table BORDER CELLPADDING=3 CELLSPACING=1> 32edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * <caption>Summary of BlockingDeque methods</caption> 336232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER COLSPAN = 5> <b>First Element (Head)</b></td> 356232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td></td> 386232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Throws exception</em></td> 396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Special value</em></td> 406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Blocks</em></td> 416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Times out</em></td> 426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 446232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Insert</b></td> 456232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #addFirst addFirst(e)}</td> 46a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerFirst(Object) offerFirst(e)}</td> 476232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #putFirst putFirst(e)}</td> 48a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerFirst(Object, long, TimeUnit) offerFirst(e, time, unit)}</td> 496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Remove</b></td> 526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #removeFirst removeFirst()}</td> 536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollFirst pollFirst()}</td> 546232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #takeFirst takeFirst()}</td> 556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}</td> 566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 586232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Examine</b></td> 596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #getFirst getFirst()}</td> 606232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #peekFirst peekFirst()}</td> 616232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><em>not applicable</em></td> 626232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><em>not applicable</em></td> 636232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 656232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER COLSPAN = 5> <b>Last Element (Tail)</b></td> 666232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 676232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td></td> 696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Throws exception</em></td> 706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Special value</em></td> 716232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Blocks</em></td> 726232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER><em>Times out</em></td> 736232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 746232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 756232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Insert</b></td> 766232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #addLast addLast(e)}</td> 77a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerLast(Object) offerLast(e)}</td> 786232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #putLast putLast(e)}</td> 79a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td> 806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 816232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 826232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Remove</b></td> 836232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #removeLast() removeLast()}</td> 846232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollLast() pollLast()}</td> 856232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #takeLast takeLast()}</td> 866232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollLast(long, TimeUnit) pollLast(time, unit)}</td> 876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 896232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><b>Examine</b></td> 906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #getLast getLast()}</td> 916232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #peekLast peekLast()}</td> 926232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><em>not applicable</em></td> 936232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td><em>not applicable</em></td> 946232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </table> 966232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 9791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * <p>Like any {@link BlockingQueue}, a {@code BlockingDeque} is thread safe, 986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * does not permit null elements, and may (or may not) be 996232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * capacity-constrained. 1006232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 10191770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * <p>A {@code BlockingDeque} implementation may be used directly as a FIFO 10291770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code BlockingQueue}. The methods inherited from the 10391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code BlockingQueue} interface are precisely equivalent to 10491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code BlockingDeque} methods as indicated in the following table: 1056232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 1066232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <table BORDER CELLPADDING=3 CELLSPACING=1> 107edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * <caption>Comparison of BlockingQueue and BlockingDeque methods</caption> 1086232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 10991770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * <td ALIGN=CENTER> <b>{@code BlockingQueue} Method</b></td> 11091770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * <td ALIGN=CENTER> <b>Equivalent {@code BlockingDeque} Method</b></td> 1116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1126232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1136232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER COLSPAN = 2> <b>Insert</b></td> 1146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1156232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 116a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #add(Object) add(e)}</td> 117a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #addLast(Object) addLast(e)}</td> 1186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1196232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 120a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offer(Object) offer(e)}</td> 121a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerLast(Object) offerLast(e)}</td> 1226232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 124a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #put(Object) put(e)}</td> 125a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #putLast(Object) putLast(e)}</td> 1266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 128a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offer(Object, long, TimeUnit) offer(e, time, unit)}</td> 129a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td> 1306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1316232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1326232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER COLSPAN = 2> <b>Remove</b></td> 1336232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1356232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #remove() remove()}</td> 1366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #removeFirst() removeFirst()}</td> 1376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1386232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #poll() poll()}</td> 1406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollFirst() pollFirst()}</td> 1416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #take() take()}</td> 1446232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #takeFirst() takeFirst()}</td> 1456232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1466232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1476232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #poll(long, TimeUnit) poll(time, unit)}</td> 1486232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}</td> 1496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td ALIGN=CENTER COLSPAN = 2> <b>Examine</b></td> 1526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1546232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #element() element()}</td> 1556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #getFirst() getFirst()}</td> 1566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <tr> 1586232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #peek() peek()}</td> 1596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <td>{@link #peekFirst() peekFirst()}</td> 1606232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </tr> 1616232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * </table> 1626232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 1636232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>Memory consistency effects: As with other concurrent 1646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * collections, actions in a thread prior to placing an object into a 1656232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * {@code BlockingDeque} 1666232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a> 1676232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * actions subsequent to the access or removal of that element from 1686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * the {@code BlockingDeque} in another thread. 1696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 1706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This interface is a member of the 171d2449bb576ad1e3a3877364e5e1ae28625f69e35Yi Kong * <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/collections/index.html"> 1726232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Java Collections Framework</a>. 1736232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 1746232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @since 1.6 1756232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @author Doug Lea 176e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * @param <E> the type of elements held in this deque 1776232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 1786232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilsonpublic interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> { 1796232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /* 1806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * We have "diamond" multiple interface inheritance here, and that 1816232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * introduces ambiguities. Methods might end up with different 1826232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * specs depending on the branch chosen by javadoc. Thus a lot of 1836232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * methods specs here are copied from superinterfaces. 1846232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 1856232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 1866232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 1876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the front of this deque if it is 1886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * possible to do so immediately without violating capacity restrictions, 18991770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * throwing an {@code IllegalStateException} if no space is currently 1906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * available. When using a capacity-restricted deque, it is generally 191a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * preferable to use {@link #offerFirst(Object) offerFirst}. 1926232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 1936232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 1946232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalStateException {@inheritDoc} 1956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException {@inheritDoc} 1966232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 1976232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException {@inheritDoc} 1986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 1996232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void addFirst(E e); 2006232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2016232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2026232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the end of this deque if it is 2036232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * possible to do so immediately without violating capacity restrictions, 20491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * throwing an {@code IllegalStateException} if no space is currently 2056232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * available. When using a capacity-restricted deque, it is generally 206a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * preferable to use {@link #offerLast(Object) offerLast}. 2076232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2086232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2096232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalStateException {@inheritDoc} 2106232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException {@inheritDoc} 2116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2126232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException {@inheritDoc} 2136232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void addLast(E e); 2156232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2166232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2176232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the front of this deque if it is 2186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * possible to do so immediately without violating capacity restrictions, 21991770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * returning {@code true} upon success and {@code false} if no space is 2206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * currently available. 2216232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * When using a capacity-restricted deque, this method is generally 222a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * preferable to the {@link #addFirst(Object) addFirst} method, which can 2236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * fail to insert an element only by throwing an exception. 2246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException {@inheritDoc} 2276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException {@inheritDoc} 2296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offerFirst(E e); 2316232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2326232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2336232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the end of this deque if it is 2346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * possible to do so immediately without violating capacity restrictions, 23591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * returning {@code true} upon success and {@code false} if no space is 2366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * currently available. 2376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * When using a capacity-restricted deque, this method is generally 238a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * preferable to the {@link #addLast(Object) addLast} method, which can 2396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * fail to insert an element only by throwing an exception. 2406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException {@inheritDoc} 2436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2446232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException {@inheritDoc} 2456232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2466232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offerLast(E e); 2476232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2486232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the front of this deque, 2506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting if necessary for space to become available. 2516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 2546232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 2556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 2566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 2586232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 2596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2606232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void putFirst(E e) throws InterruptedException; 2616232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2626232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2636232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the end of this deque, 2646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting if necessary for space to become available. 2656232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2666232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2676232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 2686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 2696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 2706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2716232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 2726232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 2736232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2746232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void putLast(E e) throws InterruptedException; 2756232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2766232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2776232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the front of this deque, 2786232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting up to the specified wait time if necessary for space to 2796232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * become available. 2806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 2816232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 2826232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param timeout how long to wait before giving up, in units of 28391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code unit} 28491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @param unit a {@code TimeUnit} determining how to interpret the 28591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code timeout} parameter 28691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if successful, or {@code false} if 2876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * the specified waiting time elapses before space is available 2886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 2896232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 2906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 2916232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 2926232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 2936232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 2946232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 2956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offerFirst(E e, long timeout, TimeUnit unit) 2966232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 2976232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 2986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 2996232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element at the end of this deque, 3006232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting up to the specified wait time if necessary for space to 3016232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * become available. 3026232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3036232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 3046232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param timeout how long to wait before giving up, in units of 30591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code unit} 30691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @param unit a {@code TimeUnit} determining how to interpret the 30791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code timeout} parameter 30891770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if successful, or {@code false} if 3096232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * the specified waiting time elapses before space is available 3106232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 3116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 3126232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 3136232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 3146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 3156232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 3166232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3176232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offerLast(E e, long timeout, TimeUnit unit) 3186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 3196232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3216232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the first element of this deque, waiting 3226232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * if necessary until an element becomes available. 3236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the head of this deque 3256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 3266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E takeFirst() throws InterruptedException; 3286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the last element of this deque, waiting 3316232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * if necessary until an element becomes available. 3326232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3336232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the tail of this deque 3346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 3356232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E takeLast() throws InterruptedException; 3376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3386232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the first element of this deque, waiting 3406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * up to the specified wait time if necessary for an element to 3416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * become available. 3426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param timeout how long to wait before giving up, in units of 34491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code unit} 34591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @param unit a {@code TimeUnit} determining how to interpret the 34691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code timeout} parameter 34791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return the head of this deque, or {@code null} if the specified 3486232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting time elapses before an element is available 3496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 3506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E pollFirst(long timeout, TimeUnit unit) 3526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 3536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3546232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the last element of this deque, waiting 3566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * up to the specified wait time if necessary for an element to 3576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * become available. 3586232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param timeout how long to wait before giving up, in units of 36091770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code unit} 36191770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @param unit a {@code TimeUnit} determining how to interpret the 36291770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code timeout} parameter 36391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return the tail of this deque, or {@code null} if the specified 3646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * waiting time elapses before an element is available 3656232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 3666232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3676232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E pollLast(long timeout, TimeUnit unit) 3686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 3696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3716232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Removes the first occurrence of the specified element from this deque. 3726232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * If the deque does not contain the element, it is unchanged. 37391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * More formally, removes the first element {@code e} such that 37491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code o.equals(e)} (if such an element exists). 37591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * Returns {@code true} if this deque contained the specified element 3766232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (or equivalently, if this deque changed as a result of the call). 3776232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3786232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param o element to be removed from this deque, if present 37991770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if an element was removed as a result of this call 3806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 381a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * is incompatible with this deque 382e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 383a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * @throws NullPointerException if the specified element is null 384e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 3856232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 3866232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean removeFirstOccurrence(Object o); 3876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 3886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 3896232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Removes the last occurrence of the specified element from this deque. 3906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * If the deque does not contain the element, it is unchanged. 39191770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * More formally, removes the last element {@code e} such that 39291770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code o.equals(e)} (if such an element exists). 39391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * Returns {@code true} if this deque contained the specified element 3946232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (or equivalently, if this deque changed as a result of the call). 3956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 3966232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param o element to be removed from this deque, if present 39791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if an element was removed as a result of this call 3986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 399a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * is incompatible with this deque 400e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 401a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * @throws NullPointerException if the specified element is null 402e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 4036232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4046232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean removeLastOccurrence(Object o); 4056232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4066232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson // *** BlockingQueue methods *** 4076232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4086232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 4096232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element into the queue represented by this deque 4106232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, at the tail of this deque) if it is possible to do so 4116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * immediately without violating capacity restrictions, returning 41291770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code true} upon success and throwing an 41391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code IllegalStateException} if no space is currently available. 4146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * When using a capacity-restricted deque, it is generally preferable to 415a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * use {@link #offer(Object) offer}. 4166232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 417a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <p>This method is equivalent to {@link #addLast(Object) addLast}. 4186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4196232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 4206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalStateException {@inheritDoc} 4216232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 4226232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 4236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 4246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 4256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 4266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean add(E e); 4286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 4306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element into the queue represented by this deque 4316232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, at the tail of this deque) if it is possible to do so 4326232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * immediately without violating capacity restrictions, returning 43391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code true} upon success and {@code false} if no space is currently 4346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * available. When using a capacity-restricted deque, this method is 4356232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * generally preferable to the {@link #add} method, which can fail to 4366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * insert an element only by throwing an exception. 4376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 438a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <p>This method is equivalent to {@link #offerLast(Object) offerLast}. 4396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 4416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 4426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 4436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 4446232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 4456232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 4466232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4476232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offer(E e); 4486232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 4506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element into the queue represented by this deque 4516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, at the tail of this deque), waiting if necessary for 4526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * space to become available. 4536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 454a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <p>This method is equivalent to {@link #putLast(Object) putLast}. 4556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 4576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException {@inheritDoc} 4586232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 4596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 4606232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 4616232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 4626232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 4636232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void put(E e) throws InterruptedException; 4656232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4666232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 4676232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Inserts the specified element into the queue represented by this deque 4686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, at the tail of this deque), waiting up to the 4696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * specified wait time if necessary for space to become available. 4706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4716232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to 472a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * {@link #offerLast(Object,long,TimeUnit) offerLast}. 4736232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4746232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param e the element to add 47591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if the element was added to this deque, else 47691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code false} 4776232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException {@inheritDoc} 4786232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 4796232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * prevents it from being added to this deque 4806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 4816232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException if some property of the specified 4826232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * element prevents it from being added to this deque 4836232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4846232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean offer(E e, long timeout, TimeUnit unit) 4856232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 4866232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 4876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 4886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the head of the queue represented by this deque 4896232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, the first element of this deque). 4906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * This method differs from {@link #poll poll} only in that it 4916232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * throws an exception if this deque is empty. 4926232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4936232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to {@link #removeFirst() removeFirst}. 4946232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 4956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the head of the queue represented by this deque 4966232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NoSuchElementException if this deque is empty 4976232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 4986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E remove(); 4996232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5006232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5016232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the head of the queue represented by this deque 5026232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, the first element of this deque), or returns 50391770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code null} if this deque is empty. 5046232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5056232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to {@link #pollFirst()}. 5066232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 50791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return the head of this deque, or {@code null} if this deque is empty 5086232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5096232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E poll(); 5106232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5126232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the head of the queue represented by this deque 5136232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, the first element of this deque), waiting if 5146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * necessary until an element becomes available. 5156232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5166232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to {@link #takeFirst() takeFirst}. 5176232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5186232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the head of this deque 5196232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 5206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5216232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E take() throws InterruptedException; 5226232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves and removes the head of the queue represented by this deque 5256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (in other words, the first element of this deque), waiting up to the 5266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * specified wait time if necessary for an element to become available. 5276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to 5296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * {@link #pollFirst(long,TimeUnit) pollFirst}. 5306232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 53191770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return the head of this deque, or {@code null} if the 5326232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * specified waiting time elapses before an element is available 5336232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws InterruptedException if interrupted while waiting 5346232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5356232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E poll(long timeout, TimeUnit unit) 5366232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson throws InterruptedException; 5376232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5386232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5396232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves, but does not remove, the head of the queue represented by 5406232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * this deque (in other words, the first element of this deque). 5416232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * This method differs from {@link #peek peek} only in that it throws an 5426232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * exception if this deque is empty. 5436232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5446232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to {@link #getFirst() getFirst}. 5456232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5466232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the head of this deque 5476232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NoSuchElementException if this deque is empty 5486232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5496232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E element(); 5506232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5516232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5526232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Retrieves, but does not remove, the head of the queue represented by 5536232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * this deque (in other words, the first element of this deque), or 55491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * returns {@code null} if this deque is empty. 5556232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5566232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to {@link #peekFirst() peekFirst}. 5576232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 55891770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return the head of this deque, or {@code null} if this deque is empty 5596232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5606232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson E peek(); 5616232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5626232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5636232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Removes the first occurrence of the specified element from this deque. 5646232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * If the deque does not contain the element, it is unchanged. 56591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * More formally, removes the first element {@code e} such that 56691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * {@code o.equals(e)} (if such an element exists). 56791770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * Returns {@code true} if this deque contained the specified element 5686232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * (or equivalently, if this deque changed as a result of the call). 5696232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5706232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * <p>This method is equivalent to 571a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * {@link #removeFirstOccurrence(Object) removeFirstOccurrence}. 5726232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5736232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param o element to be removed from this deque, if present 57491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if this deque changed as a result of the call 5756232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 576a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * is incompatible with this deque 577e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 578a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * @throws NullPointerException if the specified element is null 579e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 5806232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 5816232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson boolean remove(Object o); 5826232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5836232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 58491770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * Returns {@code true} if this deque contains the specified element. 58591770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * More formally, returns {@code true} if and only if this deque contains 58691770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * at least one element {@code e} such that {@code o.equals(e)}. 5876232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 5886232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @param o object to be checked for containment in this deque 58991770798d8b9280d48d30df2ed7f63b3ed9b036fCalin Juravle * @return {@code true} if this deque contains the specified element 5906232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException if the class of the specified element 591a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * is incompatible with this deque 592e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 593a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * @throws NullPointerException if the specified element is null 594e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak * (<a href="../Collection.html#optional-restrictions">optional</a>) 5956232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 596e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak boolean contains(Object o); 5976232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 5986232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 5996232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Returns the number of elements in this deque. 6006232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 6016232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return the number of elements in this deque 6026232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 603e8b323c7cb7d55be9a4df579231e44f04f53d766Przemyslaw Szczepaniak int size(); 6046232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 6056232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 6066232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * Returns an iterator over the elements in this deque in proper sequence. 6076232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * The elements will be returned in order from first (head) to last (tail). 6086232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 6096232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @return an iterator over the elements in this deque in proper sequence 6106232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 6116232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson Iterator<E> iterator(); 6126232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 6136232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson // *** Stack methods *** 6146232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson 6156232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson /** 616edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * Pushes an element onto the stack represented by this deque (in other 617edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * words, at the head of this deque) if it is possible to do so 618edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * immediately without violating capacity restrictions, throwing an 619edf43d27e240d82106f39ae91404963c23987234Narayan Kamath * {@code IllegalStateException} if no space is currently available. 6206232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 621a807b4d808d2591894daf13aab179b2e9c46a2f5Jesse Wilson * <p>This method is equivalent to {@link #addFirst(Object) addFirst}. 6226232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * 6236232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalStateException {@inheritDoc} 6246232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws ClassCastException {@inheritDoc} 6256232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws NullPointerException if the specified element is null 6266232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson * @throws IllegalArgumentException {@inheritDoc} 6276232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson */ 6286232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson void push(E e); 6296232a5efed0ea103e35aec73206e5e03a8b82e0cJesse Wilson} 630