java.util.ArrayDeque.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中java.util.ArrayDeque.<init>()方法的一些代码示例,展示了ArrayDeque.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayDeque.<init>()方法的具体详情如下:
包路径:java.util.ArrayDeque
类名称:ArrayDeque
方法名:<init>

ArrayDeque.<init>介绍

[英]Constructs an empty array deque with an initial capacity sufficient to hold 16 elements.
[中]构造一个初始容量足以容纳16个元素的空数组deque。

代码示例

代码示例来源:origin: ReactiveX/RxJava

BufferSkipObserver(Observer<? super U> actual, int count, int skip, Callable<U> bufferSupplier) {
  this.downstream = actual;
  this.count = count;
  this.skip = skip;
  this.bufferSupplier = bufferSupplier;
  this.buffers = new ArrayDeque<U>();
}

代码示例来源:origin: ReactiveX/RxJava

WindowSkipObserver(Observer<? super Observable<T>> actual, long count, long skip, int capacityHint) {
  this.downstream = actual;
  this.count = count;
  this.skip = skip;
  this.capacityHint = capacityHint;
  this.windows = new ArrayDeque<UnicastSubject<T>>();
}

代码示例来源:origin: google/guava

/**
 * Creates an empty {@code ArrayDeque}.
 *
 * @since 12.0
 */
public static <E> ArrayDeque<E> newArrayDeque() {
 return new ArrayDeque<E>();
}

代码示例来源:origin: spring-projects/spring-framework

private Deque<TypedValue> initScopeRootObjects() {
  if (this.scopeRootObjects == null) {
    this.scopeRootObjects = new ArrayDeque<>();
  }
  return this.scopeRootObjects;
}

代码示例来源:origin: ReactiveX/RxJava

MergeObserver(Observer<? super U> actual, Function<? super T, ? extends ObservableSource<? extends U>> mapper,
    boolean delayErrors, int maxConcurrency, int bufferSize) {
  this.downstream = actual;
  this.mapper = mapper;
  this.delayErrors = delayErrors;
  this.maxConcurrency = maxConcurrency;
  this.bufferSize = bufferSize;
  if (maxConcurrency != Integer.MAX_VALUE) {
    sources = new ArrayDeque<ObservableSource<? extends U>>(maxConcurrency);
  }
  this.observers = new AtomicReference<InnerObserver<?, ?>[]>(EMPTY);
}

代码示例来源:origin: ReactiveX/RxJava

OnBackpressureBufferStrategySubscriber(Subscriber<? super T> actual, Action onOverflow,
    BackpressureOverflowStrategy strategy, long bufferSize) {
  this.downstream = actual;
  this.onOverflow = onOverflow;
  this.strategy = strategy;
  this.bufferSize = bufferSize;
  this.requested = new AtomicLong();
  this.deque = new ArrayDeque<T>();
}

代码示例来源:origin: ReactiveX/RxJava

PublisherBufferOverlappingSubscriber(Subscriber<? super C> actual, int size, int skip,
    Callable<C> bufferSupplier) {
  this.downstream = actual;
  this.size = size;
  this.skip = skip;
  this.bufferSupplier = bufferSupplier;
  this.once = new AtomicBoolean();
  this.buffers = new ArrayDeque<C>();
}

代码示例来源:origin: google/guava

private EvictingQueue(int maxSize) {
 checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize);
 this.delegate = new ArrayDeque<E>(maxSize);
 this.maxSize = maxSize;
}

代码示例来源:origin: spring-projects/spring-framework

public void pushActiveContextObject(TypedValue obj) {
  if (this.contextObjects == null) {
    this.contextObjects = new ArrayDeque<>();
  }
  this.contextObjects.push(obj);
}

代码示例来源:origin: spring-projects/spring-framework

public void popActiveContextObject() {
  if (this.contextObjects == null) {
    this.contextObjects = new ArrayDeque<>();
  }
  try {
    this.contextObjects.pop();
  }
  catch (NoSuchElementException ex) {
    throw new IllegalStateException("Cannot pop active context object: stack is empty");
  }
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Construct a new {@code CodeFlow} for the given class.
 * @param className the name of the class
 * @param classWriter the corresponding ASM {@code ClassWriter}
 */
public CodeFlow(String className, ClassWriter classWriter) {
  this.className = className;
  this.classWriter = classWriter;
  this.compilationScopes = new ArrayDeque<>();
  this.compilationScopes.add(new ArrayList<String>());
}

代码示例来源:origin: ReactiveX/RxJava

ConcatMapEagerMainObserver(Observer<? super R> actual,
    Function<? super T, ? extends ObservableSource<? extends R>> mapper,
    int maxConcurrency, int prefetch, ErrorMode errorMode) {
  this.downstream = actual;
  this.mapper = mapper;
  this.maxConcurrency = maxConcurrency;
  this.prefetch = prefetch;
  this.errorMode = errorMode;
  this.error = new AtomicThrowable();
  this.observers = new ArrayDeque<InnerQueuedObserver<R>>();
}

代码示例来源:origin: iluwatar/java-design-patterns

public BstIterator(TreeNode<T> root) {
 pathStack = new ArrayDeque<>();
 pushPathToNextSmallest(root);
}

代码示例来源:origin: ReactiveX/RxJava

WindowOverlapSubscriber(Subscriber<? super Flowable<T>> actual, long size, long skip, int bufferSize) {
  super(1);
  this.downstream = actual;
  this.size = size;
  this.skip = skip;
  this.queue = new SpscLinkedArrayQueue<UnicastProcessor<T>>(bufferSize);
  this.windows = new ArrayDeque<UnicastProcessor<T>>();
  this.once = new AtomicBoolean();
  this.firstRequest = new AtomicBoolean();
  this.requested = new AtomicLong();
  this.wip = new AtomicInteger();
  this.bufferSize = bufferSize;
}

代码示例来源:origin: google/guava

@Override
 public Queue<String> create(String[] elements) {
  return new ArrayDeque<>(MinimalCollection.of(elements));
 }
})

代码示例来源:origin: google/guava

/**
 * Reads all bytes from an input stream into a byte array. Does not close the stream.
 *
 * @param in the input stream to read from
 * @return a byte array containing all the bytes from the stream
 * @throws IOException if an I/O error occurs
 */
public static byte[] toByteArray(InputStream in) throws IOException {
 checkNotNull(in);
 return toByteArrayInternal(in, new ArrayDeque<byte[]>(TO_BYTE_ARRAY_DEQUE_SIZE), 0);
}

代码示例来源:origin: spring-projects/spring-framework

private Deque<VariableScope> initVariableScopes() {
  if (this.variableScopes == null) {
    this.variableScopes = new ArrayDeque<>();
    // top-level empty variable scope
    this.variableScopes.add(new VariableScope());
  }
  return this.variableScopes;
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void doubleOnSubscribe() {
  TestHelper.doubleOnSubscribe(new BlockingSubscriber<Integer>(new ArrayDeque<Object>()));
}

代码示例来源:origin: ReactiveX/RxJava

@Test
  public void dispose() {
    Queue<Object> q = new ArrayDeque<Object>();

    BlockingObserver<Object> bo = new BlockingObserver<Object>(q);

    bo.dispose();

    assertEquals(BlockingObserver.TERMINATED, q.poll());

    bo.dispose();

    assertNull(q.poll());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void cancel() {
  BlockingSubscriber<Integer> bq = new BlockingSubscriber<Integer>(new ArrayDeque<Object>());
  assertFalse(bq.isCancelled());
  bq.cancel();
  assertTrue(bq.isCancelled());
  bq.cancel();
  assertTrue(bq.isCancelled());
}

相关文章