java.util.ArrayDeque.push()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(189)

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

ArrayDeque.push介绍

[英]Pushes an element onto the stack represented by this deque. In other words, inserts the element at the front of this deque.

This method is equivalent to #addFirst.
[中]将一个元素推送到这个deque表示的堆栈上。换言之,在该三角形的前面插入元素。
此方法相当于#addFirst。

代码示例

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

public void push( ObjectInputStream in ) {
  wrappedStack.push(in);
  wrapped = in;
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
public void enterNested(RuleLangParser.NestedContext ctx) {
  // nested field access is ok, these are not rule variables
  isIdIsFieldAccess.push(true);
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
public void enterMessageRef(RuleLangParser.MessageRefContext ctx) {
  // nested field access is ok, these are not rule variables
  isIdIsFieldAccess.push(true);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Marks the given <code>NativeObject</code> as unused, 
 * to be deleted on the next frame. 
 * Usage of this object after deletion will cause an exception. 
 * Note that native buffers are only reclaimed if 
 * {@link #UNSAFE} is set to <code>true</code>.
 * 
 * @param obj The object to mark as unused.
 */
void enqueueUnusedObject(NativeObject obj) {
  userDeletionQueue.push(obj);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

public void push( ObjectInputStream in ) {
  wrappedStack.push(in);
  wrapped = in;
}

代码示例来源:origin: iluwatar/java-design-patterns

/**
 * This BstIterator manages to use O(h) extra space, where h is the height of the tree It achieves
 * this by maintaining a stack of the nodes to handle (pushing all left nodes first), before
 * handling self or right node
 *
 * @param node TreeNode that acts as root of the subtree we're interested in.
 */
private void pushPathToNextSmallest(TreeNode<T> node) {
 while (node != null) {
  pathStack.push(node);
  node = node.getLeft();
 }
}

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

private void offer(T theObject)
 {
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
   if (objects.size() < maxSize) {
    objects.push(theObject);
    notEnough.signal();
   } else {
    throw new ISE("Cannot exceed pre-configured maximum size");
   }
  }
  finally {
   lock.unlock();
  }
 }
}

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

public void pushNdc(String message) {
  ArrayDeque<Entry> stack = ndcStack.get();
  if (stack == null) {
    stack = new ArrayDeque<Entry>();
    ndcStack.set(stack);
  }
  stack.push(stack.isEmpty() ? new Entry(message) : new Entry(stack.peek(), message));
}

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

private static void findUnannotatedTypeVarRefs(
  TypeVariableSymbol typeVar,
  Tree sourceNode,
  Type type,
  ArrayDeque<Integer> partialSelector,
  ImmutableSet.Builder<InferenceVariable> resultBuilder) {
 List<Type> typeArguments = type.getTypeArguments();
 for (int i = 0; i < typeArguments.size(); i++) {
  partialSelector.push(i);
  findUnannotatedTypeVarRefs(
    typeVar, sourceNode, typeArguments.get(i), partialSelector, resultBuilder);
  partialSelector.pop();
 }
 if (type.tsym.equals(typeVar) && !toNullness(type.getAnnotationMirrors()).isPresent()) {
  resultBuilder.add(
    TypeArgInferenceVar.create(ImmutableList.copyOf(partialSelector), sourceNode));
 }
}

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

Map<GridCacheVersion, GridCacheVersion> edgeTo = new HashMap<>();
stack.push(txId);
    stack.push(w);

代码示例来源:origin: Graylog2/graylog2-server

public RuleAstBuilder(ParseContext parseContext) {
  this.parseContext = parseContext;
  args = parseContext.arguments();
  argsList = parseContext.argumentLists();
  exprs = parseContext.expressions();
  isIdIsFieldAccess.push(false); // top of stack
}

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

private void generateConstraintsFromAnnotations(
  Type type, Tree sourceTree, ArrayDeque<Integer> argSelector) {
 List<Type> typeArguments = type.getTypeArguments();
 int numberOfTypeArgs = typeArguments.size();
 for (int i = 0; i < numberOfTypeArgs; i++) {
  argSelector.push(i);
  generateConstraintsFromAnnotations(typeArguments.get(i), sourceTree, argSelector);
  argSelector.pop();
 }
 // Use equality constraints even for top-level type, since we want to "trust" the annotation
 // TODO(b/121398981): skip for T extends @<Annot> since they constrain one side only
 ProperInferenceVar.fromTypeIfAnnotated(type)
   .ifPresent(
     annot -> {
      qualifierConstraints.putEdge(
        TypeArgInferenceVar.create(ImmutableList.copyOf(argSelector), sourceTree), annot);
      qualifierConstraints.putEdge(
        annot, TypeArgInferenceVar.create(ImmutableList.copyOf(argSelector), sourceTree));
     });
}

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

private void generateConstraintsFromAnnotations(
  MethodSymbol symbol, JCMethodInvocation sourceTree, ArrayDeque<Integer> argSelector) {
 List<Type> typeArguments = sourceTree.type.getTypeArguments();
 int numberOfTypeArgs = typeArguments.size();
 for (int i = 0; i < numberOfTypeArgs; i++) {
  argSelector.push(i);
  generateConstraintsFromAnnotations(typeArguments.get(i), sourceTree, argSelector);
  argSelector.pop();
 }
 // First check if the given symbol is directly annotated; if not, look for implicit annotations
 // on the inferred type of the expression.  The latter for instance propagates a type parameter
 // T instantiated as <@Nullable String> to the result of a method returning T.
 Optional<InferenceVariable> fromAnnotations =
   Nullness.fromAnnotationsOn(symbol).map(ProperInferenceVar::create);
 if (!fromAnnotations.isPresent()) {
  fromAnnotations = ProperInferenceVar.fromTypeIfAnnotated(sourceTree.type);
 }
 // Use equality constraints here, since we want to "trust" the annotation.  For instance,
 // a method return annotated @Nullable requires us assume the method might really return null,
 // and a method return annotated @Nonnull should allow us to assume it really returns non-null.
 fromAnnotations.ifPresent(
   annot -> {
    qualifierConstraints.putEdge(
      TypeArgInferenceVar.create(ImmutableList.copyOf(argSelector), sourceTree), annot);
    // TODO(b/121398981): skip for T extends @<Annot> since they constrain one side only
    qualifierConstraints.putEdge(
      annot, TypeArgInferenceVar.create(ImmutableList.copyOf(argSelector), sourceTree));
   });
}

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

} while(!startTag.name.equals(tagName));
} else if (!isVoidTag) {
 startTagStack.push(StartTag.buildStartTag(fullTagExpression, spannedText.length()));

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

List<Type> typeArguments = lType.getTypeArguments();
for (int i = 0; i < typeArguments.size(); i++) {
 argSelector.push(i);
 generateConstraintsForWrite(typeArguments.get(i), rVal, lVal, argSelector);
 argSelector.pop();

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

try {
 TtmlNode node = parseNode(xmlParser, parent, regionMap, frameAndTickRate);
 nodeStack.push(node);
 if (parent != null) {
  parent.addChild(node);

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

toProduce.push( inner );
return;
  toProduce.push( inner );
  return;

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

containerAtoms.push(new ContainerAtom(atomType, endPosition));
if (atomSize == atomHeaderBytesRead) {
 processAtomEnded(endPosition);

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

containerAtoms.push(new ContainerAtom(atomType, endPosition));
if (atomSize == atomHeaderBytesRead) {
 processAtomEnded(endPosition);

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

long elementContentPosition = input.getPosition();
long elementEndPosition = elementContentPosition + elementContentSize;
masterElementsStack.push(new MasterElement(elementId, elementEndPosition));
output.startMasterElement(elementId, elementContentPosition, elementContentSize);
elementState = ELEMENT_STATE_READ_ID;

相关文章