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

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

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

ArrayDeque.element介绍

[英]Retrieves, but does not remove, the head of the queue represented by this deque. This method differs from #peek only in that it throws an exception if this deque is empty.

This method is equivalent to #getFirst.
[中]检索但不删除此deque表示的队列头。此方法与#peek的不同之处在于,如果此deque为空,则会引发异常。
此方法相当于#getFirst。

代码示例

代码示例来源:origin: spring-projects/spring-framework

public TypedValue getScopeRootContextObject() {
  if (CollectionUtils.isEmpty(this.scopeRootObjects)) {
    return this.rootObject;
  }
  return this.scopeRootObjects.element();
}

代码示例来源:origin: org.springframework/spring-expression

public TypedValue getScopeRootContextObject() {
  if (CollectionUtils.isEmpty(this.scopeRootObjects)) {
    return this.rootObject;
  }
  return this.scopeRootObjects.element();
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public T element() {
  return queue.element();
}

代码示例来源:origin: org.zeromq/jeromq

@Override
public ZFrame element()
{
  return frames.element();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public T element() {
  return queue.element();
}

代码示例来源:origin: baidu/brpc-java

@Override
public E element() {
  return queue.element();
}

代码示例来源:origin: arteam/100-Java-Concurrency-questions

@Override
public synchronized T element() {
  return deque.element();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public T element() {
  return queue.element();
}

代码示例来源:origin: com.baidu/brpc-java

@Override
public E element() {
  return queue.element();
}

代码示例来源:origin: org.codelibs/elasticsearch-querybuilders

@Override
public T element() {
  return queue.element();
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public T element() {
  return queue.element();
}

代码示例来源:origin: us.ihmc/IHMCCommunication

/**
* Warning: The returned element will be reused and modified by this deque when adding a new element.
* {@inheritDoc}
*/
@Override
public C element()
{
 C commandToReturn = super.element();
 unusedCommands.add(commandToReturn);
 return commandToReturn;
}

代码示例来源:origin: apache/servicemix-bundles

public TypedValue getScopeRootContextObject() {
  if (CollectionUtils.isEmpty(this.scopeRootObjects)) {
    return this.rootObject;
  }
  return this.scopeRootObjects.element();
}

代码示例来源:origin: EvoSuite/evosuite

public void testMe(ArrayDeque<Integer> integerDeque) {
    int x = integerDeque.element();
  }
}

代码示例来源:origin: com.google.javascript/closure-compiler

@Override
public boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) {
 if (n.isFunction()) {
  contextStack.push(LexicalContext.newContextForFunction(contextStack.element(), n));
 }
 return true;
}

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * Helper function for both HotSwapCompilerPass#hotSwapScript and CompilerPass#process.
 *
 * @param root Root of AST to rewrite
 */
private void process(Node root) {
 checkState(contextStack.isEmpty());
 contextStack.push(LexicalContext.newGlobalContext());
 TranspilationPasses.processTranspile(compiler, root, transpiledFeatures, this);
 TranspilationPasses.maybeMarkFeaturesAsTranspiledAway(compiler, transpiledFeatures);
 checkState(contextStack.element().function == null);
 contextStack.remove();
 checkState(contextStack.isEmpty());
}

代码示例来源:origin: mayconbordin/storm-applications

public void add(SlidingWindowEntry entry, SlidingWindowCallback callback) {
  //System.out.println("Adding " + entry.getTime());
  // very first entry in the window
  if (tsStart == 0l) {
    tsStart = entry.getTime();
  }
  // add the entry
  window.addLast(entry);
  // sliding window should be moved.
  if (entry.getTime() > tsEnd) {
    // update the timestamp end timestamp
    tsEnd = entry.getTime();
    // now we need to remove the entries which are expired
    long newTsStart = tsEnd - length + 1;
    ArrayList<SlidingWindowEntry> removed = new ArrayList<SlidingWindowEntry>();
    while (tsStart < newTsStart) {
      if (window.element().getTime() < newTsStart) {
        removed.add(window.removeFirst());
        tsStart = window.element().getTime();
      }
    }
    callback.remove(removed);
  }
  /*System.out.println("start:" + window.element().getTime() + "    end:" + window.getLast().getTime());
  System.out.print("{");
  for (SlidingWindowEntry e : window) {
    System.out.print(e.getTime() + ", ");
  }
  System.out.print("}\n"); */
}

代码示例来源:origin: com.google.javascript/closure-compiler

@Override
public void visit(NodeTraversal t, Node n, Node parent) {
 LexicalContext ctx = contextStack.element();
 switch (n.getToken()) {

相关文章