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

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

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

Deque.removeLast介绍

[英]Retrieves and removes the last element of this deque. This method differs from #pollLast only in that it throws an exception if this deque is empty.
[中]检索并删除此数据块的最后一个元素。此方法与#pollLast的不同之处在于,如果此deque为空,则会引发异常。

代码示例

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

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

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

create().offerLast("e");
create().removeFirst();
create().removeLast();
create().pollFirst();
create().pollLast();

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

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

代码示例来源:origin: json-path/JsonPath

private String removeLast() {
  lock.lock();
  try {
    final String removedKey = queue.removeLast();
    return removedKey;
  } finally {
    lock.unlock();
  }
}

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

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

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

public static <V> V removeLast(Deque<V> queue) {
  if (queue instanceof BTraceDeque || queue.getClass().getClassLoader() == null) {
    return queue.removeLast();
  } else {
    throw new IllegalArgumentException();
  }
}

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

if (topConcat.metaIterators != null) {
 while (!topConcat.metaIterators.isEmpty()) {
  this.metaIterators.addFirst(topConcat.metaIterators.removeLast());

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

@CanIgnoreReturnValue
@Override
public E removeLast() {
 return delegate().removeLast();
}

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

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

代码示例来源:origin: alibaba/jstorm

public Map<K, V> rotate() {
  Map<K, V> dead = buckets.removeLast();
  if (isSingleThread) {
    buckets.addFirst(new HashMap<K, V>());
  } else {
    buckets.addFirst(new ConcurrentHashMap<K, V>());
  }
  if (callback != null) {
    for (Entry<K, V> entry : dead.entrySet()) {
      callback.expire(entry.getKey(), entry.getValue());
    }
  }
  return dead;
}

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

@CanIgnoreReturnValue
@Override
public E removeLast() {
 return delegate().removeLast();
}

代码示例来源:origin: MovingBlocks/Terasology

private void processColorCode(char c) {
  if (c == FontColor.getReset()) {
    if (!previousColors.isEmpty()) {
      currentColor = previousColors.removeLast();
    }
  } else {
    previousColors.addLast(currentColor);
    currentColor = FontColor.toColor(c);
  }
}

代码示例来源: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: google/j2objc

@CanIgnoreReturnValue
@Override
public E removeLast() {
 return delegate().removeLast();
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void setHUDVisible(boolean visible) {
  if (visible) {
    if (!isHUDVisible()) {
      screens.addLast(hudScreenLayer);
    }
  } else {
    if (isHUDVisible()) {
      screens.removeLast();
    }
  }
}

代码示例来源: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: google/j2objc

/**
 * 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: MovingBlocks/Terasology

private void applyCinematicEffect() {
  previousPositions.addFirst(new Vector3f(position));
  previousViewingDirections.addFirst(new Vector3f(viewingDirection));
  CameraSetting cameraSetting = cameraSettings.getCameraSetting();
  while (previousPositions.size() > cameraSetting.getSmoothingFrames()) {
    previousPositions.removeLast();
    previousViewingDirections.removeLast();
  }
  position.set(calculateVector(previousPositions));
  viewingDirection.set(calculateVector(previousViewingDirections));
}

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

private static void populateSequences(
  List<List<Long>> possibleSequences,
  Deque<Long> currentSequence,
  int current,
  int max,
  int maxDepth
)
{
 possibleSequences.add(new ArrayList<>(currentSequence));
 if (currentSequence.size() == maxDepth) {
  return;
 }
 for (int i = current; i < max; i++) {
  currentSequence.addLast((long) i);
  populateSequences(possibleSequences, currentSequence, i, max, maxDepth);
  currentSequence.removeLast();
 }
}

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

@Override
public void leaveToken(DetailAST ast) {
  if (isOverridingMethod(ast)) {
    final MethodNode methodNode =
      methodStack.removeLast();
    if (!methodNode.isCallingSuper()) {
      final DetailAST methodAST = methodNode.getMethod();
      final DetailAST nameAST =
        methodAST.findFirstToken(TokenTypes.IDENT);
      log(nameAST, MSG_KEY, nameAST.getText());
    }
  }
}

相关文章