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

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

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

Deque.offerFirst介绍

[英]Inserts the specified element at the front of this deque unless it would violate capacity restrictions. When using a capacity-restricted deque, this method is generally preferable to the #addFirst method, which can fail to insert an element only by throwing an exception.
[中]在此数据块的前面插入指定的元素,除非它违反容量限制。当使用容量受限的deque时,这种方法通常比#addFirst方法更可取,后者只能通过抛出异常来插入元素。

代码示例

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

@Override
public boolean offerFirst(E e) {
 synchronized (mutex) {
  return delegate().offerFirst(e);
 }
}

代码示例来源:origin: reactor/reactor-core

boolean push(ExpandDepthSubscriber<T> subscriber) {
  synchronized (this) {
    Deque<ExpandDepthSubscriber<T>> q = subscriptionStack;
    if (q != null) {
      q.offerFirst(subscriber);
      return true;
    }
    return false;
  }
}

代码示例来源:origin: btraceio/btrace

@Override
public synchronized boolean offerFirst(V e) {
  return delegate.offerFirst(e);
}

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

@Override public boolean offer(E o) {
  return q.offerFirst(o);
}

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

@Override
public boolean offerFirst(E e) {
 synchronized (mutex) {
  return delegate().offerFirst(e);
 }
}

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

public void returnBuffer(ByteBuffer byteBuffer) {
  byteBuffer.position(0);
  byteBuffer.limit(fileSize);
  this.availableBuffers.offerFirst(byteBuffer);
}

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

/** {@inheritDoc} */
@Override public boolean offerFirst(E e) {
  boolean res = deque.offerFirst(e);
  if (res)
    adder.increment();
  return res;
}

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

@Override
public boolean offerFirst(E e) {
 synchronized (mutex) {
  return delegate().offerFirst(e);
 }
}

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

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

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

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

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

@Override
public boolean offerFirst(E e) {
 synchronized (mutex) {
  return delegate().offerFirst(e);
 }
}

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

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

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

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

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

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

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

create().addFirst("e");
create().addLast("e");
create().offerFirst("e");
create().offerLast("e");
create().removeFirst();

代码示例来源:origin: jankotek/mapdb

() -> d.addFirst(null),
() -> d.addLast(null),
() -> d.offerFirst(null),
() -> d.offerLast(null),
() -> d.push(null),

代码示例来源:origin: org.apache.commons/commons-pool2

@Override
public synchronized boolean endEvictionTest(
    final Deque<PooledObject<T>> idleQueue) {
  if (state == PooledObjectState.EVICTION) {
    state = PooledObjectState.IDLE;
    return true;
  } else if (state == PooledObjectState.EVICTION_RETURN_TO_HEAD) {
    state = PooledObjectState.IDLE;
    if (!idleQueue.offerFirst(this)) {
      // TODO - Should never happen
    }
  }
  return false;
}

代码示例来源:origin: 58code/Argo

public boolean offer(E e)         { return q.offerFirst(e); }
public E poll()                   { return q.pollFirst(); }

代码示例来源:origin: didi/DDMQ

public void returnBuffer(ByteBuffer byteBuffer) {
  byteBuffer.position(0);
  byteBuffer.limit(fileSize);
  this.availableBuffers.offerFirst(byteBuffer);
}

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

it.remove();
currentPolygonSegments.offerFirst(current);
merge = true;
it.remove();
currentPolygonSegments.offerFirst(current);

相关文章