java.util.LinkedList.addLast()方法的使用及代码示例

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

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

LinkedList.addLast介绍

[英]Appends the specified element to the end of this list.

This method is equivalent to #add.
[中]将指定的元素追加到此列表的末尾。
此方法相当于#add。

代码示例

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

@Override
  public void run() {
    snapshotList.addLast(statsBenchmark.createSnapshot());
    if (snapshotList.size() > 10) {
      snapshotList.removeFirst();
    }
  }
}, 1000, 1000);

代码示例来源:origin: Sable/soot

public void outASingleParameterList(ASingleParameterList node) {
 List<Type> l = new ArrayList<Type>();
 l.add((Type) mProductions.removeLast());
 mProductions.addLast(l);
}

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

static StackTraceElement[] trimStackTrace(StackTraceElement[] stackTrace) {
 LinkedList<StackTraceElement> list = Lists.newLinkedList();
 for (int i = stackTrace.length - 1; i >= 0; i--) {
  StackTraceElement s = stackTrace[i];
  if (s.getClassName().startsWith(Checkers.class.getPackage().getName())) {
   break;
  }
  list.addLast(s);
 }
 return list.toArray(new StackTraceElement[list.size()]);
}

代码示例来源:origin: Sable/soot

public void outAThrowsClause(AThrowsClause node) {
  List l = (List) mProductions.removeLast();

  Iterator it = l.iterator();
  List<SootClass> exceptionClasses = new ArrayList<SootClass>(l.size());

  while (it.hasNext()) {
   String className = (String) it.next();

   exceptionClasses.add(mResolver.makeClassRef(className));
  }

  mProductions.addLast(exceptionClasses);
 }
}

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

private void logicalClose(Session proxy) throws JMSException {
  // Preserve rollback-on-close semantics.
  if (this.transactionOpen && this.target.getTransacted()) {
    this.transactionOpen = false;
    this.target.rollback();
  }
  // Physically close durable subscribers at time of Session close call.
  for (Iterator<Map.Entry<ConsumerCacheKey, MessageConsumer>> it = this.cachedConsumers.entrySet().iterator(); it.hasNext();) {
    Map.Entry<ConsumerCacheKey, MessageConsumer> entry = it.next();
    if (entry.getKey().subscription != null) {
      entry.getValue().close();
      it.remove();
    }
  }
  // Allow for multiple close calls...
  boolean returned = false;
  synchronized (this.sessionList) {
    if (!this.sessionList.contains(proxy)) {
      this.sessionList.addLast(proxy);
      returned = true;
    }
  }
  if (returned && logger.isTraceEnabled()) {
    logger.trace("Returned cached Session: " + this.target);
  }
}

代码示例来源:origin: org.apache.maven/maven-project

if ( pathElements.isEmpty() )
      pathElements.removeLast();
    pathElements.addLast( token );
while ( !pathElements.isEmpty() )
  cleanedPath.append( pathElements.removeFirst() );
  if ( !pathElements.isEmpty() )

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

public BitSet getTransitiveOutputSet(int input) {
  BitSet visited = new BitSet();
  BitSet result = new BitSet();
  LinkedList<Integer> workList = new LinkedList<>();
  workList.addLast(input);
  while (!workList.isEmpty()) {
    Integer valueNumber = workList.removeFirst();
    visited.set(valueNumber);
    BitSet outputSet = getOutputSet(valueNumber);
    result.or(outputSet);
    for (int i = outputSet.nextSetBit(0); i >= 0; i = outputSet.nextSetBit(i+1)) {
      if (!visited.get(i)) {
        workList.addLast(i);
      }
    }
  }
  return result;
}

代码示例来源:origin: nutzam/nutz

/**
 * 转换LIST
 * @param val
 */
private void convertList(List<?> val){
  if(paths.size() <= 0){
    paths.add("[]");
  }else{
    paths.addLast(paths.removeLast() + "[]");
  }
  for(int i = 0; i < val.size(); i++){
    arrayIndex.addLast(i);
    each(val.get(i));
    arrayIndex.removeLast();
  }
}

代码示例来源:origin: weibocom/motan

} else {
    if (operand == '0' || operand == '1') {
      list.addLast(operand);
      list.addLast(curr);
      operand = '\0';
    } else {
list.addLast(operand);
list.addLast('#');
operand = list.pop();
while (!list.isEmpty()) {
  char curr = list.pop();
  if (curr == '&') {
  } else {
    if (operand == '0' || operand == '1') {
      list.addLast(operand);
      list.addLast(curr);
      operand = '\0';
    } else {
list.addLast(operand);
while (!list.isEmpty() && (operand = list.pop()) != '1');
return operand;

代码示例来源:origin: Sable/soot

indexStack.addLast(-1);
while (!stmtStack.isEmpty()) {
 int toVisitIndex = indexStack.removeLast();
 N toVisitNode = stmtStack.getLast();

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

/**
 * After a message queue has changed we may need to perform some evictions
 * 
 * @param delta
 * @param queueSize
 */
public void onSizeChanged(MessageQueue queue, int delta, int queueSize) {
  synchronized (lock) {
    list.addLast(queue);
    size += delta;
    while (size > limit) {
      MessageQueue biggest = list.removeFirst();
      size -= biggest.evictMessage();
    }
  }
}

代码示例来源:origin: Sable/soot

public void outAThrowsClause(AThrowsClause node) {
 List l = (List) mProductions.removeLast();
 Iterator it = l.iterator();
 List<SootClass> exceptionClasses = new ArrayList<SootClass>(l.size());
 while (it.hasNext()) {
  String className = (String) it.next();
  exceptionClasses.add(mResolver.makeClassRef(className));
 }
 mProductions.addLast(exceptionClasses);
}

代码示例来源:origin: Sable/soot

public List<Unit> getUnits() {
 if (this.m_units == null) {
  this.m_units = new LinkedList<Unit>();
  for (Iterator<Block> itr = this.m_blocks.iterator(); itr.hasNext();) {
   Block b = itr.next();
   for (Iterator<Unit> itr1 = b.iterator(); itr1.hasNext();) {
    Unit u = itr1.next();
    ((LinkedList<Unit>) this.m_units).addLast(u);
   }
  }
 }
 return this.m_units;
}

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

if ( pathElements.isEmpty() )
        pathElements.removeLast();
      pathElements.addLast( token );
      break;
while ( !pathElements.isEmpty() )
  cleanedPath.append( pathElements.removeFirst() );
  if ( !pathElements.isEmpty() )

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

private static void addDebuggingLog(String level, String msg) {
  synchronized (DEBUGGING_LOGS) {
    DEBUGGING_LOGS.addLast(new Date().toString() + '\t' + level + '\t' + msg);
    while (DEBUGGING_LOGS.size() > MAX_DEBUGGING_LOGS_COUNT) {
      DEBUGGING_LOGS.removeFirst();
    }
  }
}

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

LinkedList<T> queue = new LinkedList<>();
visited.add(o);
queue.addLast(o);
while (! queue.isEmpty()) {
 for (T obj : getPredecessors(queue.removeFirst())) {
  if (! visited.contains(obj)) {
   visited.add(obj);
   queue.addLast(obj);
   result.addFirst(obj);

代码示例来源:origin: hibernate/hibernate-orm

private void closeExpression(QueryTranslatorImpl q, String lcToken) {
  if ( booleanTests.removeLast() ) { //it was a boolean expression
    if ( booleanTests.size() > 0 ) {
      // the next one up must also be
      booleanTests.removeLast();
      booleanTests.addLast( Boolean.TRUE );
    }
    // Add any joins
    appendToken( q, ( joins.removeLast() ).toString() );
  }
  else {
    StringBuilder join = joins.removeLast();
    joins.getLast().append( join.toString() );
  }
  if ( nots.removeLast() ) {
    negated = !negated;
  }
  if ( !")".equals( lcToken ) ) {
    appendToken( q, ")" );
  }
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

void doRespond(RpcCall call) throws IOException {
 synchronized (call.connection.responseQueue) {
  // must only wrap before adding to the responseQueue to prevent
  // postponed responses from being encrypted and sent out of order.
  if (call.connection.useWrap) {
   wrapWithSasl(call);
  }
  call.connection.responseQueue.addLast(call);
  if (call.connection.responseQueue.size() == 1) {
   processResponse(call.connection.responseQueue, true);
  }
 }
}

代码示例来源:origin: Sable/soot

public void outAMultiArgList(AMultiArgList node) {
 List<Value> l = (List<Value>) mProductions.removeLast();
 l.add(0, (Value) mProductions.removeLast());
 mProductions.addLast(l);
}

代码示例来源:origin: org.apache.ant/ant

@Override
public synchronized boolean retainAll(Collection<?> c) {
  if (!(c instanceof Set)) {
    c = new HashSet<>(c);
  }
  LinkedList<E> l = new LinkedList<>();
  for (E o : this) {
    if (!c.contains(o)) {
      l.addLast(o);
    }
  }
  if (!l.isEmpty()) {
    removeAll(l);
    return true;
  }
  return false;
}

相关文章