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

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

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

LinkedList.pollLast介绍

[英]Retrieves and removes the last element of this list, or returns null if this list is empty.
[中]检索并删除此列表的最后一个元素,如果此列表为空,则返回null。

代码示例

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

public Object getResult() {
  return resultStack.pollLast();
}

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

/**
 * Removes and returns last element, or null if empty.
 *
 * @return The removed element.
 */
private E innerRemoveLast() {
 E l = list.pollLast();
 if (l == null)
  return null;
 notFull.signal();
 return l;
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JobPo pollLast() {
  lock.lock();
  try {
    JobPo l = list.pollLast();
    if (l == null)
      return null;
    jobs.remove(l.getJobId());
    return l;
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JobPo pollLast() {
  lock.lock();
  try {
    JobPo l = list.pollLast();
    if (l == null)
      return null;
    jobs.remove(l.getJobId());
    return l;
  } finally {
    lock.unlock();
  }
}

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

/** Tallies a value in the histogram. */
public void add(T value) {
 int i = segmenter.segment(value);
 counts[i]++;
 totalCount++;
 if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  this.recentAdditions.pollLast();
 }
 this.recentAdditions.push(value);
}

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

/**
 * Retain the capacity to the given number; The extra counters will be cut off
 * @param newCapacity
 */
public void retain(int newCapacity) {
  this.capacity = newCapacity;
  if (this.size() > newCapacity) {
    Counter<T> toRemoved;
    for (int i = 0, n = this.size() - newCapacity; i < n; i++) {
      toRemoved = counterList.pollLast();
      this.counterMap.remove(toRemoved.item);
    }
  }
}

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

while ((req = queue.pollLast()) != null) {
 e.getRequests.addFirst(req);

代码示例来源:origin: neuland/jade4j

indentStack.poll();
tok = this.stash.pollLast();

代码示例来源:origin: jsettlers/settlers-remake

public ElementType popFront(int slotNumber) {
  if (0 <= slotNumber && slotNumber < slotTypes.length) {
    return slotLists[slotNumber].pollLast();
  } else {
    return null;
  }
}

代码示例来源:origin: org.deephacks.streamql/streamql

private Query(QueryBuilder<T> builder) {
 this.type = builder.type;
 this.comparator = builder.comparator;
 if (builder.predicates.size() == 1) {
  this.predicate = Optional.of(builder.predicates.pollLast());
 } else {
  this.predicate = Optional.empty();
 }
 this.skip = builder.skip;
 this.limit = builder.limit;
}

代码示例来源:origin: com.github.mygreen/excel-cellformatter

/**
 * スタックの値を取り出し、文字列として結合する。
 * @param stack
 * @return
 */
public static String popupAndConcat(final LinkedList<String> stack) {
  
  StringBuilder value = new StringBuilder();
  
  while(!stack.isEmpty()) {
    value.append(stack.pollLast());
  }
  
  return value.toString();
  
}

代码示例来源:origin: org.apache.avro/avro-ipc

/** Tallies a value in the histogram. */
public void add(T value) {
 int i = segmenter.segment(value);
 counts[i]++;
 totalCount++;
 if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  this.recentAdditions.pollLast();
 }
 this.recentAdditions.push(value);
}

代码示例来源:origin: org.apache.cassandra.deps/avro

/** Tallies a value in the histogram. */
public void add(T value) {
 int i = segmenter.segment(value);
 counts[i]++;
 totalCount++;
 if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  this.recentAdditions.pollLast();
 }
 this.recentAdditions.push(value);
}

代码示例来源:origin: org.ceylon-lang/com.redhat.ceylon.typechecker

private void removeLastPackageAndModuleIfNecessary() {
  packageStack.pollLast();
  final boolean moveAboveModuleLevel = currentModule != null
      && currentModule.getName().size() > packageStack.size() -1; //first package is the empty package
  if (moveAboveModuleLevel) {
    currentModule = null;
  }
}

代码示例来源:origin: jsettlers/settlers-remake

/**
 * Redo the last action, if possible
 */
public void redo() {
  if (!redoDeltas.isEmpty()) {
    MapDataDelta delta = redoDeltas.pollLast();
    MapDataDelta inverse = data.apply(delta);
    undoDeltas.addLast(inverse);
  }
  updateMenuAndToolbar();
  changedSinceLastSave = true;
}

代码示例来源:origin: jsettlers/settlers-remake

/**
 * Undo the last action, if possible
 */
public void undo() {
  if (!undoDeltas.isEmpty()) {
    MapDataDelta delta = undoDeltas.pollLast();
    MapDataDelta inverse = data.apply(delta);
    redoDeltas.addLast(inverse);
  }
  updateMenuAndToolbar();
  changedSinceLastSave = true;
}

代码示例来源:origin: broadgsa/gatk

private SimpleMergeRSIDTest(String... arg) {
  super(SimpleMergeRSIDTest.class);
  LinkedList<String> allStrings = new LinkedList<String>(Arrays.asList(arg));
  expected = allStrings.pollLast();
  inputs = allStrings;
}

代码示例来源:origin: broadgsa/gatk

private MergeAllelesTest(List<Allele>... arg) {
  super(MergeAllelesTest.class);
  LinkedList<List<Allele>> all = new LinkedList<>(Arrays.asList(arg));
  expected = all.pollLast();
  inputs = all;
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public Object pollLast() {
  if (!_directAccess && isDelayLoad()) {
    load();
  }
  return super.pollLast();
}

代码示例来源:origin: broadgsa/gatk

private MergeGenotypesTest(String name, String priority, VariantContext... arg) {
  super(MergeGenotypesTest.class, name);
  LinkedList<VariantContext> all = new LinkedList<VariantContext>(Arrays.asList(arg));
  this.expected = all.pollLast();
  inputs = all;
  this.priority = Arrays.asList(priority.split(","));
}

相关文章

微信公众号

最新文章

更多