Java 类com.google.common.collect.ForwardingDeque 实例源码

项目:papaya    文件:ThreadLocals.java   
public static <T> Deque<T> newThreadLocalDeque() {
  return new ForwardingDeque<T>() {
    private final ThreadLocal<Deque<T>> threadDeque = new ThreadLocal<Deque<T>>() {
      @Override
      protected Deque<T> initialValue() {
        return Queues.newArrayDeque();
      }
    };

    @Override
    protected Deque<T> delegate() {
      return threadDeque.get();
    }
  };
}