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

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

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

LinkedList.removeLast介绍

[英]Removes and returns the last element from this list.
[中]删除并返回此列表中的最后一个元素。

代码示例

代码示例来源:origin: org.mockito/mockito-core

public void removeLast() {
  //TODO: add specific test for synchronization of this block (it is tested by InvocationContainerImplTest at the moment)
  synchronized (invocations) {
    if (! invocations.isEmpty()) {
      invocations.removeLast();
    }
  }
}

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

/**
 * Ensures that the MRU list will have a MaxSize.
 */
protected void setMaxSize(int maxSize) {
 if (maxSize < _mruFileList.size()) {
  for (int i = 0; i < _mruFileList.size() - maxSize; i++) {
   _mruFileList.removeLast();
  }
 }
 _maxSize = maxSize;
}
//--------------------------------------------------------------------------

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

private static void addToReversePostOrderListIterative(DirectNode root, List<DirectNode> lst) {
 LinkedList<DirectNode> stackNode = new LinkedList<>();
 LinkedList<Integer> stackIndex = new LinkedList<>();
 HashSet<DirectNode> setVisited = new HashSet<>();
 stackNode.add(root);
 stackIndex.add(0);
 while (!stackNode.isEmpty()) {
  DirectNode node = stackNode.getLast();
  int index = stackIndex.removeLast();
  setVisited.add(node);
  for (; index < node.succs.size(); index++) {
   DirectNode succ = node.succs.get(index);
   if (!setVisited.contains(succ)) {
    stackIndex.add(index + 1);
    stackNode.add(succ);
    stackIndex.add(0);
    break;
   }
  }
  if (index == node.succs.size()) {
   lst.add(0, node);
   stackNode.removeLast();
  }
 }
}

代码示例来源:origin: FudanNLP/fnlp

public void add(T t, float score, T source) {
  int j = add(t,score);
  if(j>=k)
    return;
  evidences.add(j,source);
  if(evidences.size()>k)
    evidences.removeLast();
}

代码示例来源:origin: stanfordnlp/CoreNLP

boolean addedBe = false;
boolean addedSuffix = false;
if (body.size() > 1 && !"PRP".equals(body.get(0).tag())) {
 for (int i = 2; i < body.size(); ++i) {
  CoreLabel tokI = body.get(i);
  if (tokI.tag() != null &&
     i += 1;
    body.add(i, suffix.get(0));
    addedSuffix = true;
 body.add(prepNum.get(0));
 body.add(WORD_IN);
 body.add(prepNum.get(1));
   if (beIter.hasNext() && body.getLast() == beIter.next()) {
    body.removeLast();
   body.addLast(WORD_MISSING);

代码示例来源:origin: stanfordnlp/CoreNLP

while (!preTerms.isEmpty() && isPunc(preTerms.getFirst())) {
  newChildren.add(preTerms.getFirst());
  preTerms.removeFirst();
 LinkedList<Tree> temp = new LinkedList<>();
 if (newChild.children().length > 0) {
  newChildren.add(newChild);
 while (!preTerms.isEmpty() && isPunc(preTerms.getLast())) {
  temp.addFirst(preTerms.getLast());
  preTerms.removeLast();
while (!newChildren.isEmpty() && isPunc(newChildren.getFirst())) {
 newChildren.removeFirst();
while (!newChildren.isEmpty() && isPunc(newChildren.getLast())) {
 newChildren.removeLast();

代码示例来源: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: wiztools/rest-client

void openedFile(File f) {
  // Verify and remove if the same file is already in the list:
  recentFiles.remove(f);
  
  // Now, add:
  recentFiles.addFirst(f);
  
  // Remove the least recently used file from list:
  if(recentFiles.size() == 11) { // store only 10 recent files!
    recentFiles.removeLast();
  }
}

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

public void outABaseNonvoidType(ABaseNonvoidType node) {
 Type t = (Type) mProductions.removeLast();
 int dim = node.getArrayBrackets().size();
 if (dim > 0) {
  t = ArrayType.v(t, dim);
 }
 mProductions.addLast(t);
}

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

public RegionPath(String pathName) {
 regionPath = pathName;
 String[] regions = pathName.split(Region.SEPARATOR);
 LinkedList<String> regionsNames = new LinkedList<>();
 for (String region : regions) {
  if (!region.isEmpty()) {
   regionsNames.add(region);
  }
 }
 regionName = regionsNames.removeLast();
 StringBuilder parentPathBuilder = new StringBuilder();
 while (!regionsNames.isEmpty()) {
  parentPathBuilder.append(Region.SEPARATOR).append(regionsNames.removeFirst());
 }
 regionParentPath = parentPathBuilder.length() != 0 ? parentPathBuilder.toString() : null;
}

代码示例来源:origin: shekhargulati/99-problems

public static List<SimpleEntry<Integer, String>> encode_direct(List<String> list) {
  LinkedList<SimpleEntry<Integer, String>> result = new LinkedList<>();
  String lastElem = null;
  for (String elem : list) {
    if (Objects.equals(lastElem, elem)) {
      SimpleEntry<Integer, String> last = result.removeLast();
      result.add(new SimpleEntry<>(last.getKey() + 1, elem));
    } else {
      result.add(new SimpleEntry<>(1, elem));
      lastElem = elem;
    }
  }
  return result;
}

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

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

代码示例来源:origin: commons-collections/commons-collections

ll.addLast(o2);
ll.removeFirst();
ll.removeLast();
ll.add(o1);
ll.remove(0);
ll.addLast(o2);
ll.removeFirst();
ll.removeLast();
ll.add(o1);
ll.remove(0);
ll.addLast(o2);
ll.removeFirst();
ll.removeLast();
ll.add(o1);
ll.remove(0);

代码示例来源: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.maven/maven-project

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

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

if ( totalWriteCount == 0 && waitingThreadList.size() > 0 )
    LockRequest lockRequest = waitingThreadList.removeLast();
    lockRequest.waitingThread.interrupt();
    if ( lockRequest.lockType == LockType.WRITE )
  while ( !waitingThreadList.isEmpty() );

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

Edge last = partialPath.getLast();
  partialPath.add(outEdge);
  work(partialPath);
  partialPath.removeLast();

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

if ( !waitingThreadList.isEmpty() )
  LockRequest lockRequest = waitingThreadList.getLast();
      waitingThreadList.removeLast();
      lockRequest.waitingThread.interrupt();
      waitingThreadList.removeLast();
      lockRequest.waitingThread.interrupt();

代码示例来源:origin: org.codehaus.groovy/groovy

public void popImplicitThis() {
  implicitThisStack.removeLast();
  this.implicitThis = implicitThisStack.getLast();
}

相关文章