2222import java .time .Duration ;
2323import java .util .AbstractQueue ;
2424import java .util .Collection ;
25- import java .util .Deque ;
2625import java .util .Iterator ;
2726import java .util .NoSuchElementException ;
2827import java .util .Objects ;
28+ import java .util .concurrent .BlockingDeque ;
2929import java .util .concurrent .TimeUnit ;
3030import java .util .concurrent .locks .Condition ;
3131
6666 * @since 2.0
6767 */
6868final class LinkedBlockingDeque <E > extends AbstractQueue <E >
69- implements Deque <E >, Serializable {
69+ implements BlockingDeque <E >, Serializable {
7070
7171 /*
7272 * Implemented as a simple doubly-linked list protected by a
@@ -493,7 +493,8 @@ public Iterator<E> descendingIterator() {
493493 * @throws NullPointerException if c is null
494494 * @throws IllegalArgumentException if c is this instance
495495 */
496- int drainTo (final Collection <? super E > c ) {
496+ @ Override
497+ public int drainTo (final Collection <? super E > c ) {
497498 return drainTo (c , Integer .MAX_VALUE );
498499 }
499500
@@ -512,7 +513,8 @@ int drainTo(final Collection<? super E> c) {
512513 * @throws NullPointerException if c is null
513514 * @throws IllegalArgumentException if c is this instance
514515 */
515- int drainTo (final Collection <? super E > collection , final int maxElements ) {
516+ @ Override
517+ public int drainTo (final Collection <? super E > collection , final int maxElements ) {
516518 Objects .requireNonNull (collection , "c" );
517519 if (collection == this ) {
518520 throw new IllegalArgumentException ();
@@ -716,7 +718,8 @@ boolean offer(final E e, final Duration timeout) throws InterruptedException {
716718 * @throws InterruptedException if the thread is interrupted whilst waiting
717719 * for space
718720 */
719- boolean offer (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
721+ @ Override
722+ public boolean offer (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
720723 return offerLast (e , timeout , unit );
721724 }
722725
@@ -774,7 +777,8 @@ boolean offerFirst(final E e, final Duration timeout) throws InterruptedExceptio
774777 * @throws InterruptedException if the thread is interrupted whilst waiting
775778 * for space
776779 */
777- boolean offerFirst (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
780+ @ Override
781+ public boolean offerFirst (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
778782 return offerFirst (e , PoolImplUtils .toDuration (timeout , unit ));
779783 }
780784
@@ -832,7 +836,8 @@ boolean offerLast(final E e, final Duration timeout) throws InterruptedException
832836 * @throws InterruptedException if the thread is interrupted whist waiting
833837 * for space
834838 */
835- boolean offerLast (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
839+ @ Override
840+ public boolean offerLast (final E e , final long timeout , final TimeUnit unit ) throws InterruptedException {
836841 return offerLast (e , PoolImplUtils .toDuration (timeout , unit ));
837842 }
838843
@@ -893,7 +898,8 @@ E poll(final Duration timeout) throws InterruptedException {
893898 * @return the unlinked element
894899 * @throws InterruptedException if the current thread is interrupted
895900 */
896- E poll (final long timeout , final TimeUnit unit ) throws InterruptedException {
901+ @ Override
902+ public E poll (final long timeout , final TimeUnit unit ) throws InterruptedException {
897903 return pollFirst (timeout , unit );
898904 }
899905
@@ -941,7 +947,8 @@ E pollFirst(final Duration timeout) throws InterruptedException {
941947 * @return the unlinked element
942948 * @throws InterruptedException if the current thread is interrupted
943949 */
944- E pollFirst (final long timeout , final TimeUnit unit ) throws InterruptedException {
950+ @ Override
951+ public E pollFirst (final long timeout , final TimeUnit unit ) throws InterruptedException {
945952 return pollFirst (PoolImplUtils .toDuration (timeout , unit ));
946953 }
947954
@@ -989,7 +996,8 @@ E pollLast(final Duration timeout) throws InterruptedException {
989996 * @return the unlinked element
990997 * @throws InterruptedException if the current thread is interrupted
991998 */
992- E pollLast (final long timeout , final TimeUnit unit )
999+ @ Override
1000+ public E pollLast (final long timeout , final TimeUnit unit )
9931001 throws InterruptedException {
9941002 return pollLast (PoolImplUtils .toDuration (timeout , unit ));
9951003 }
@@ -1023,7 +1031,8 @@ public void push(final E e) {
10231031 * @throws InterruptedException if the thread is interrupted whilst waiting
10241032 * for space
10251033 */
1026- void put (final E e ) throws InterruptedException {
1034+ @ Override
1035+ public void put (final E e ) throws InterruptedException {
10271036 putLast (e );
10281037 }
10291038
@@ -1036,7 +1045,8 @@ void put(final E e) throws InterruptedException {
10361045 * @throws InterruptedException if the thread is interrupted whilst waiting
10371046 * for space
10381047 */
1039- void putFirst (final E e ) throws InterruptedException {
1048+ @ Override
1049+ public void putFirst (final E e ) throws InterruptedException {
10401050 Objects .requireNonNull (e , "e" );
10411051 lock .lock ();
10421052 try {
@@ -1057,7 +1067,8 @@ void putFirst(final E e) throws InterruptedException {
10571067 * @throws InterruptedException if the thread is interrupted whilst waiting
10581068 * for space
10591069 */
1060- void putLast (final E e ) throws InterruptedException {
1070+ @ Override
1071+ public void putLast (final E e ) throws InterruptedException {
10611072 Objects .requireNonNull (e , "e" );
10621073 lock .lock ();
10631074 try {
@@ -1105,7 +1116,8 @@ private void readObject(final ObjectInputStream s) throws IOException, ClassNotF
11051116 *
11061117 * @return The number of additional elements the queue is able to accept
11071118 */
1108- int remainingCapacity () {
1119+ @ Override
1120+ public int remainingCapacity () {
11091121 lock .lock ();
11101122 try {
11111123 return capacity - count ;
@@ -1283,7 +1295,8 @@ public int size() {
12831295 * @return the unlinked element
12841296 * @throws InterruptedException if the current thread is interrupted
12851297 */
1286- E take () throws InterruptedException {
1298+ @ Override
1299+ public E take () throws InterruptedException {
12871300 return takeFirst ();
12881301 }
12891302
@@ -1294,7 +1307,8 @@ E take() throws InterruptedException {
12941307 * @return the unlinked element
12951308 * @throws InterruptedException if the current thread is interrupted
12961309 */
1297- E takeFirst () throws InterruptedException {
1310+ @ Override
1311+ public E takeFirst () throws InterruptedException {
12981312 lock .lock ();
12991313 try {
13001314 E x ;
@@ -1314,7 +1328,8 @@ E takeFirst() throws InterruptedException {
13141328 * @return the unlinked element
13151329 * @throws InterruptedException if the current thread is interrupted
13161330 */
1317- E takeLast () throws InterruptedException {
1331+ @ Override
1332+ public E takeLast () throws InterruptedException {
13181333 lock .lock ();
13191334 try {
13201335 E x ;
0 commit comments