java.util.Deque.pollLast()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(352)

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

Deque.pollLast介绍

[英]Retrieves and removes the last element of this deque, or returns null if this deque is empty.
[中]检索并删除此数据块的最后一个元素,如果此数据块为空,则返回null。

代码示例

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

@Override
public E pollLast() {
 synchronized (mutex) {
  return delegate().pollLast();
 }
}

代码示例来源:origin: netty/netty

/**
 * Poll a {@link Channel} out of the internal storage to reuse it. This will return {@code null} if no
 * {@link Channel} is ready to be reused.
 *
 * Sub-classes may override {@link #pollChannel()} and {@link #offerChannel(Channel)}. Be aware that
 * implementations of these methods needs to be thread-safe!
 */
protected Channel pollChannel() {
  return lastRecentUsed ? deque.pollLast() : deque.pollFirst();
}

代码示例来源:origin: AsyncHttpClient/async-http-client

public <E> E lease(Deque<E> d) {
  return d.pollLast();
 }
};

代码示例来源:origin: redisson/redisson

/**
 * Poll a {@link Channel} out of the internal storage to reuse it. This will return {@code null} if no
 * {@link Channel} is ready to be reused.
 *
 * Sub-classes may override {@link #pollChannel()} and {@link #offerChannel(Channel)}. Be aware that
 * implementations of these methods needs to be thread-safe!
 */
protected Channel pollChannel() {
  return lastRecentUsed ? deque.pollLast() : deque.pollFirst();
}

代码示例来源:origin: apache/kafka

/**
 * Attempt to ensure we have at least the requested number of bytes of memory for allocation by deallocating pooled
 * buffers (if needed)
 */
private void freeUp(int size) {
  while (!this.free.isEmpty() && this.nonPooledAvailableMemory < size)
    this.nonPooledAvailableMemory += this.free.pollLast().capacity();
}

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

@Override
public E pollLast() {
 synchronized (mutex) {
  return delegate().pollLast();
 }
}

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

/**
 * Undo last spell
 */
public void undoLastSpell() {
 if (!undoStack.isEmpty()) {
  Command previousSpell = undoStack.pollLast();
  redoStack.offerLast(previousSpell);
  LOGGER.info("{} undoes {}", this, previousSpell);
  previousSpell.undo();
 }
}

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

/**
 * Redo last spell
 */
public void redoLastSpell() {
 if (!redoStack.isEmpty()) {
  Command previousSpell = redoStack.pollLast();
  undoStack.offerLast(previousSpell);
  LOGGER.info("{} redoes {}", this, previousSpell);
  previousSpell.redo();
 }
}

代码示例来源:origin: apache/kafka

/**
 * Get the oldest request (the one that will be completed next) for the given node
 */
public NetworkClient.InFlightRequest completeNext(String node) {
  NetworkClient.InFlightRequest inFlightRequest = requestQueue(node).pollLast();
  inFlightRequestCount.decrementAndGet();
  return inFlightRequest;
}

代码示例来源:origin: prestodb/presto

@Override
public E pollLast() {
 synchronized (mutex) {
  return delegate().pollLast();
 }
}

代码示例来源:origin: jersey/jersey

private void _reset() {
  final Integer _pos = mark.pollLast(); // also performs "unmark" functionality
  final int markedPos = (_pos == null) ? -1 : _pos;
  if (markedPos >= 0 && markedPos < issues.size()) {
    issues.subList(markedPos, issues.size()).clear();
  }
}

代码示例来源:origin: jersey/jersey

private void _reset() {
  final Integer _pos = mark.pollLast(); // also performs "unmark" functionality
  final int markedPos = (_pos == null) ? -1 : _pos;
  if (markedPos >= 0 && markedPos < issues.size()) {
    issues.subList(markedPos, issues.size()).clear();
  }
}

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

@Override
public E pollLast() {
 assertTrue(Thread.holdsLock(mutex));
 return delegate.pollLast();
}

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

@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public E pollLast() {
 return delegate().pollLast();
}

代码示例来源:origin: prestodb/presto

@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public E pollLast() {
 return delegate().pollLast();
}

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

@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public E pollLast() {
 return delegate().pollLast();
}

代码示例来源:origin: netty/netty

boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
  final long handle;
  if ((normCapacity & subpageOverflowMask) != 0) { // >= pageSize
    handle =  allocateRun(normCapacity);
  } else {
    handle = allocateSubpage(normCapacity);
  }
  if (handle < 0) {
    return false;
  }
  ByteBuffer nioBuffer = cachedNioBuffers != null ? cachedNioBuffers.pollLast() : null;
  initBuf(buf, nioBuffer, handle, reqCapacity);
  return true;
}

代码示例来源:origin: redisson/redisson

boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
  final long handle;
  if ((normCapacity & subpageOverflowMask) != 0) { // >= pageSize
    handle =  allocateRun(normCapacity);
  } else {
    handle = allocateSubpage(normCapacity);
  }
  if (handle < 0) {
    return false;
  }
  ByteBuffer nioBuffer = cachedNioBuffers != null ? cachedNioBuffers.pollLast() : null;
  initBuf(buf, nioBuffer, handle, reqCapacity);
  return true;
}

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

switch (strategy) {
case DROP_LATEST:
  dq.pollLast();
  dq.offer(t);
  callOnOverflow = true;

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

create().removeLast();
create().pollFirst();
create().pollLast();
create().getFirst();
create().getLast();

相关文章