Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2012 The Guava Authors
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package com.google.common.collect;
 
A java.util.concurrent.BlockingDeque which forwards all its method calls to another BlockingDeque. Subclasses should override one or more methods to modify the behavior of the backing deque as desired per the decorator pattern.

Warning: The methods of ForwardingBlockingDeque forward indiscriminately to the methods of the delegate. For example, overriding ForwardingCollection.add(java.lang.Object) alone will not change the behaviour of ForwardingQueue.offer(java.lang.Object) which can lead to unexpected behaviour. In this case, you should override offer as well, either providing your own implementation, or delegating to the provided standardOffer method.

The standard methods are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.

Author(s):
Emily Soldal
Since:
14.0
 
 public abstract class ForwardingBlockingDeque<E>
     extends ForwardingDeque<E> implements BlockingDeque<E> {

  
Constructor for use by subclasses.
 
   protected ForwardingBlockingDeque() {}
 
   @Override protected abstract BlockingDeque<E> delegate();
 
   @Override
   public int remainingCapacity() {
     return delegate().remainingCapacity();
   }
 
   @Override
   public void putFirst(E ethrows InterruptedException {
     delegate().putFirst(e);
   }
 
   @Override
   public void putLast(E ethrows InterruptedException {
     delegate().putLast(e);
   }
 
   @Override
   public boolean offerFirst(E elong timeoutTimeUnit unitthrows InterruptedException {
     return delegate().offerFirst(etimeoutunit);
   }
 
   @Override
   public boolean offerLast(E elong timeoutTimeUnit unitthrows InterruptedException {
     return delegate().offerLast(etimeoutunit);
   }
 
   @Override
   public E takeFirst() throws InterruptedException {
     return delegate().takeFirst();
   }
 
   @Override
   public E takeLast() throws InterruptedException {
     return delegate().takeLast();
   }
 
   @Override
   public E pollFirst(long timeoutTimeUnit unitthrows InterruptedException {
     return delegate().pollFirst(timeoutunit);
   }
 
   @Override
   public E pollLast(long timeoutTimeUnit unitthrows InterruptedException {
     return delegate().pollLast(timeoutunit);
   }
 
   @Override
   public void put(E ethrows InterruptedException {
     delegate().put(e);
   }
 
   @Override
  public boolean offer(E elong timeoutTimeUnit unitthrows InterruptedException {
    return delegate().offer(etimeoutunit);
  }
  public E take() throws InterruptedException {
    return delegate().take();
  }
  public E poll(long timeoutTimeUnit unitthrows InterruptedException {
    return delegate().poll(timeoutunit);
  }
  public int drainTo(Collection<? super E> c) {
    return delegate().drainTo(c);
  }
  public int drainTo(Collection<? super E> cint maxElements) {
    return delegate().drainTo(cmaxElements);
  }
New to GrepCode? Check out our FAQ X