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

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

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

Deque.offerLast介绍

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

代码示例

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

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

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

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

代码示例来源: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: iluwatar/java-design-patterns

/**
 * Cast spell
 */
public void castSpell(Command command, Target target) {
 LOGGER.info("{} casts {} at {}", this, command, target);
 command.execute(target);
 undoStack.offerLast(command);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

代码示例来源:origin: google/error-prone

@Override
public Void visitStartElement(StartElementTree startTree, Void unused) {
 if (PRE_TAGS.contains(startTree.getName().toString())) {
  startPosStack.offerLast(getEndPosition(startTree, state));
  containsAnotherTag = false;
 }
 return super.visitStartElement(startTree, null);
}

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

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

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

Pair<Integer, Integer> star = starInCol(path.getLast().getSecond());
if (star != null) {
 path.offerLast(star);
} else {
 break;
path.offerLast(prime);

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

_idle.offerLast(new TimedObject<T>(obj));
} else {
 _checkedOut++;

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

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

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

() -> d.addLast(null),
() -> d.offerFirst(null),
() -> d.offerLast(null),
() -> d.push(null),
() -> d.descendingIterator().forEachRemaining(null));

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

path.offerLast(new Pair<>(zero.getFirst(), zero.getSecond()));
return true;

相关文章