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

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

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

Deque.addLast介绍

[英]Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions. When using a capacity-restricted deque, it is generally preferable to use method #offerLast.

This method is equivalent to #add.
[中]如果可以在不违反容量限制的情况下立即插入指定的元素,则在该数据的末尾插入该元素。当使用容量受限设备时,通常最好使用方法#offerLast。
此方法相当于#add。

代码示例

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

@Override
  public void release(byte[] buffer)
  {
    synchronized (this) {
      bufferQueue.addLast(buffer);
    }
  }
}

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

@Override
public void addLast(E e) {
 synchronized (mutex) {
  delegate().addLast(e);
 }
}

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

/**
 * Adds an {@link AbstractImportRule} to the node.
 * @param rule the rule to be added.
 */
protected void addImportRule(AbstractImportRule rule) {
  rules.addLast(rule);
}

代码示例来源:origin: apache/incubator-druid

public void add(byte[] bytesToAdd)
{
 if (bytesToAdd.length == 0) {
  return;
 }
 synchronized (singleByteReaderDoer) {
  bytes.addLast(bytesToAdd);
  available += bytesToAdd.length;
  singleByteReaderDoer.notify();
 }
}

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

@Override
public void addLast(E e) {
 synchronized (mutex) {
  delegate().addLast(e);
 }
}

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

@Override
public void addLast(E e) {
 delegate().addLast(e);
}

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

@Override
public void release(ByteBuffer buffer) {
  buffer.clear();
  Deque<ByteBuffer> bufferQueue = bufferMap.get(buffer.capacity());
  if (bufferQueue == null) {
    // We currently keep a single buffer in flight, so optimise for that case
    bufferQueue = new ArrayDeque<>(1);
    bufferMap.put(buffer.capacity(), bufferQueue);
  }
  bufferQueue.addLast(buffer);
}

代码示例来源:origin: skylot/jadx

private void store(Level level, String msg) {
  buffer.addLast(new LogEvent(level, msg));
  if (buffer.size() > BUFFER_SIZE) {
    buffer.pollFirst();
  }
}

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

public HiveFileIterator(
    Path path,
    FileSystem fileSystem,
    DirectoryLister directoryLister,
    NamenodeStats namenodeStats,
    NestedDirectoryPolicy nestedDirectoryPolicy)
{
  paths.addLast(requireNonNull(path, "path is null"));
  this.fileSystem = requireNonNull(fileSystem, "fileSystem is null");
  this.directoryLister = requireNonNull(directoryLister, "directoryLister is null");
  this.namenodeStats = requireNonNull(namenodeStats, "namenodeStats is null");
  this.nestedDirectoryPolicy = requireNonNull(nestedDirectoryPolicy, "nestedDirectoryPolicy is null");
}

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

@Override
public void addLast(E e) {
 synchronized (mutex) {
  delegate().addLast(e);
 }
}

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

@Override
public void addLast(E e) {
 delegate().addLast(e);
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public void useDefault() {
  getUsedHistoryQueue().addLast(DEFAULT_DATASOURCE_ID);
  if (logger.isDebugEnabled()) {
    logger.debug("try use default data source");
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Override
public void use(String dataSourceId) {
  //添加对队尾
  getUsedHistoryQueue().addLast(dataSourceId);
  if (logger.isDebugEnabled()) {
    logger.debug("try use data source : {}", dataSourceId);
  }
}

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

@Override
public void addLast(E e) {
 assertTrue(Thread.holdsLock(mutex));
 delegate.addLast(e);
}

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

/**
 * An analogue of {@link java.util.function.DoubleFunction} also accepting an index.
 *
 * <p>This interface is only intended for use by callers of {@link #mapWithIndex(DoubleStream,
 * DoubleFunctionWithIndex)}.
 *
 * @since 21.0
 */
@Beta
public interface DoubleFunctionWithIndex<R> {
 /** Applies this function to the given argument and its index within a stream. */
 R apply(double from, long index);
}

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

@Implementation
protected boolean postRotate(float degrees) {
 postOps.addLast(ROTATE + " " + Float.toString(degrees));
 return postConcat(SimpleMatrix.rotate(degrees));
}

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

/**
 * An analogue of {@link java.util.function.DoubleFunction} also accepting an index.
 *
 * <p>This interface is only intended for use by callers of {@link #mapWithIndex(DoubleStream,
 * DoubleFunctionWithIndex)}.
 *
 * @since 21.0
 */
@Beta
public interface DoubleFunctionWithIndex<R> {
 /** Applies this function to the given argument and its index within a stream. */
 R apply(double from, long index);
}

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

@Implementation
protected boolean postTranslate(float dx, float dy) {
 postOps.addLast(TRANSLATE + " " + dx + " " + dy);
 return postConcat(SimpleMatrix.translate(dx, dy));
}

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

@Implementation
protected boolean postScale(float sx, float sy) {
 postOps.addLast(SCALE + " " + sx + " " + sy);
 return postConcat(SimpleMatrix.scale(sx, sy));
}

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

@Implementation
protected boolean postSkew(float kx, float ky) {
 postOps.addLast(SKEW + " " + kx + " " + ky);
 return postConcat(SimpleMatrix.skew(kx, ky));
}

相关文章