本文整理了Java中java.util.Deque.addFirst()
方法的一些代码示例,展示了Deque.addFirst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Deque.addFirst()
方法的具体详情如下:
包路径:java.util.Deque
类名称:Deque
方法名:addFirst
[英]Inserts the specified element at the front 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 #offerFirst.
[中]如果可以在不违反容量限制的情况下立即插入指定的元素,则在该元素的前面插入该元素。使用容量受限设备时,通常最好使用方法#offerFirst。
代码示例来源:origin: google/j2objc
@Override
public void addFirst(E e) {
synchronized (mutex) {
delegate().addFirst(e);
}
}
代码示例来源:origin: prestodb/presto
public <C extends AutoCloseable> C register(C closeable)
{
requireNonNull(closeable, "closeable is null");
stack.addFirst(closeable);
return closeable;
}
代码示例来源:origin: apache/incubator-druid
/**
* Registers the given {@code closeable} to be closed when this {@code Closer} is
* {@linkplain #close closed}.
*
* @return the given {@code closeable}
*/
// close. this word no longer has any meaning to me.
public <C extends Closeable> C register(@Nullable C closeable)
{
if (closeable != null) {
stack.addFirst(closeable);
}
return closeable;
}
代码示例来源:origin: google/guava
@Override
public void addFirst(E e) {
synchronized (mutex) {
delegate().addFirst(e);
}
}
代码示例来源:origin: google/guava
@Override
public void addFirst(E e) {
delegate().addFirst(e);
}
代码示例来源:origin: apache/kafka
/**
* Add the given request to the queue for the connection it was directed to
*/
public void add(NetworkClient.InFlightRequest request) {
String destination = request.destination;
Deque<NetworkClient.InFlightRequest> reqs = this.requests.get(destination);
if (reqs == null) {
reqs = new ArrayDeque<>();
this.requests.put(destination, reqs);
}
reqs.addFirst(request);
inFlightRequestCount.incrementAndGet();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* To be kept in sync with {@link FilePathVF#computeRelativePathToRoot()}
*/
private String computeRelativePathToRoot(){
if (this.root.equals(this.f)) {
return "";
}
Deque<String> relativePath = new LinkedList<>();
File current = this.f;
while (current != null && !current.equals(this.root)) {
relativePath.addFirst(current.getName());
current = current.getParentFile();
}
return String.join(File.separator, relativePath) + File.separator;
}
}
代码示例来源:origin: prestodb/presto
@Override
public void addFirst(E e) {
synchronized (mutex) {
delegate().addFirst(e);
}
}
代码示例来源:origin: google/guava
this.metaIterators = new ArrayDeque<>();
this.metaIterators.addFirst(this.topMetaIterator);
if (topConcat.metaIterators != null) {
while (!topConcat.metaIterators.isEmpty()) {
this.metaIterators.addFirst(topConcat.metaIterators.removeLast());
代码示例来源:origin: prestodb/presto
@Override
public void addFirst(E e) {
delegate().addFirst(e);
}
代码示例来源:origin: google/guava
@Override
public void addFirst(E e) {
assertTrue(Thread.holdsLock(mutex));
delegate.addFirst(e);
}
代码示例来源:origin: google/guava
/**
* Registers the given {@code closeable} to be closed when this {@code Closer} is {@linkplain
* #close closed}.
*
* @return the given {@code closeable}
*/
// close. this word no longer has any meaning to me.
@CanIgnoreReturnValue
public <C extends Closeable> C register(@Nullable C closeable) {
if (closeable != null) {
stack.addFirst(closeable);
}
return closeable;
}
代码示例来源:origin: prestodb/presto
/**
* Registers the given {@code closeable} to be closed when this {@code Closer} is {@linkplain
* #close closed}.
*
* @return the given {@code closeable}
*/
// close. this word no longer has any meaning to me.
@CanIgnoreReturnValue
public <C extends Closeable> C register(@NullableDecl C closeable) {
if (closeable != null) {
stack.addFirst(closeable);
}
return closeable;
}
代码示例来源:origin: apache/kafka
/**
* Re-enqueue the given record batch in the accumulator. In Sender.completeBatch method, we check
* whether the batch has reached deliveryTimeoutMs or not. Hence we do not do the delivery timeout check here.
*/
public void reenqueue(ProducerBatch batch, long now) {
batch.reenqueued(now);
Deque<ProducerBatch> deque = getOrCreateDeque(batch.topicPartition);
synchronized (deque) {
if (transactionManager != null)
insertInSequenceOrder(deque, batch);
else
deque.addFirst(batch);
}
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preSkew(float kx, float ky, float px, float py) {
preOps.addFirst(SKEW + " " + kx + " " + ky + " " + px + " " + py);
return preConcat(SimpleMatrix.skew(kx, ky, px, py));
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preTranslate(float dx, float dy) {
preOps.addFirst(TRANSLATE + " " + dx + " " + dy);
return preConcat(SimpleMatrix.translate(dx, dy));
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preConcat(Matrix other) {
preOps.addFirst(MATRIX + " " + other);
return preConcat(getSimpleMatrix(other));
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preRotate(float degrees, float px, float py) {
preOps.addFirst(ROTATE + " " + degrees + " " + px + " " + py);
return preConcat(SimpleMatrix.rotate(degrees, px, py));
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preScale(float sx, float sy, float px, float py) {
preOps.addFirst(SCALE + " " + sx + " " + sy + " " + px + " " + py);
return preConcat(SimpleMatrix.scale(sx, sy, px, py));
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected boolean preScale(float sx, float sy) {
preOps.addFirst(SCALE + " " + sx + " " + sy);
return preConcat(SimpleMatrix.scale(sx, sy));
}
内容来源于网络,如有侵权,请联系作者删除!