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>(); }
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>>(); }
/** * Creates an empty {@code ArrayDeque}. * * @since 12.0 */ public static <E> ArrayDeque<E> newArrayDeque() { return new ArrayDeque<E>(); }
private Deque<TypedValue> initScopeRootObjects() { if (this.scopeRootObjects == null) { this.scopeRootObjects = new ArrayDeque<>(); } return this.scopeRootObjects; }
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); }
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>(); }
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>(); }
private EvictingQueue(int maxSize) { checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize); this.delegate = new ArrayDeque<E>(maxSize); this.maxSize = maxSize; }
public void pushActiveContextObject(TypedValue obj) { if (this.contextObjects == null) { this.contextObjects = new ArrayDeque<>(); } this.contextObjects.push(obj); }
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"); } }
/** * 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>()); }
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>>(); }
public BstIterator(TreeNode<T> root) { pathStack = new ArrayDeque<>(); pushPathToNextSmallest(root); }
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; }
@Override public Queue<String> create(String[] elements) { return new ArrayDeque<>(MinimalCollection.of(elements)); } })
/** * 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); }
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; }
@Test public void doubleOnSubscribe() { TestHelper.doubleOnSubscribe(new BlockingSubscriber<Integer>(new ArrayDeque<Object>())); }
@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()); } }
@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()); }