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

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

本文整理了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

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

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

  1. /**
  2. * Removes and returns last element, or null if empty.
  3. *
  4. * @return The removed element.
  5. */
  6. private E innerRemoveLast() {
  7. E l = list.pollLast();
  8. if (l == null)
  9. return null;
  10. notFull.signal();
  11. return l;
  12. }

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

  1. public JobPo pollLast() {
  2. lock.lock();
  3. try {
  4. JobPo l = list.pollLast();
  5. if (l == null)
  6. return null;
  7. jobs.remove(l.getJobId());
  8. return l;
  9. } finally {
  10. lock.unlock();
  11. }
  12. }

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

  1. public JobPo pollLast() {
  2. lock.lock();
  3. try {
  4. JobPo l = list.pollLast();
  5. if (l == null)
  6. return null;
  7. jobs.remove(l.getJobId());
  8. return l;
  9. } finally {
  10. lock.unlock();
  11. }
  12. }

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

  1. /** Tallies a value in the histogram. */
  2. public void add(T value) {
  3. int i = segmenter.segment(value);
  4. counts[i]++;
  5. totalCount++;
  6. if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  7. this.recentAdditions.pollLast();
  8. }
  9. this.recentAdditions.push(value);
  10. }

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

  1. /**
  2. * Retain the capacity to the given number; The extra counters will be cut off
  3. * @param newCapacity
  4. */
  5. public void retain(int newCapacity) {
  6. this.capacity = newCapacity;
  7. if (this.size() > newCapacity) {
  8. Counter<T> toRemoved;
  9. for (int i = 0, n = this.size() - newCapacity; i < n; i++) {
  10. toRemoved = counterList.pollLast();
  11. this.counterMap.remove(toRemoved.item);
  12. }
  13. }
  14. }

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

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

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

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

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

  1. public ElementType popFront(int slotNumber) {
  2. if (0 <= slotNumber && slotNumber < slotTypes.length) {
  3. return slotLists[slotNumber].pollLast();
  4. } else {
  5. return null;
  6. }
  7. }

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

  1. private Query(QueryBuilder<T> builder) {
  2. this.type = builder.type;
  3. this.comparator = builder.comparator;
  4. if (builder.predicates.size() == 1) {
  5. this.predicate = Optional.of(builder.predicates.pollLast());
  6. } else {
  7. this.predicate = Optional.empty();
  8. }
  9. this.skip = builder.skip;
  10. this.limit = builder.limit;
  11. }

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

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

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

  1. /** Tallies a value in the histogram. */
  2. public void add(T value) {
  3. int i = segmenter.segment(value);
  4. counts[i]++;
  5. totalCount++;
  6. if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  7. this.recentAdditions.pollLast();
  8. }
  9. this.recentAdditions.push(value);
  10. }

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

  1. /** Tallies a value in the histogram. */
  2. public void add(T value) {
  3. int i = segmenter.segment(value);
  4. counts[i]++;
  5. totalCount++;
  6. if (this.recentAdditions.size() > Histogram.MAX_HISTORY_SIZE) {
  7. this.recentAdditions.pollLast();
  8. }
  9. this.recentAdditions.push(value);
  10. }

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

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

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

  1. /**
  2. * Redo the last action, if possible
  3. */
  4. public void redo() {
  5. if (!redoDeltas.isEmpty()) {
  6. MapDataDelta delta = redoDeltas.pollLast();
  7. MapDataDelta inverse = data.apply(delta);
  8. undoDeltas.addLast(inverse);
  9. }
  10. updateMenuAndToolbar();
  11. changedSinceLastSave = true;
  12. }

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

  1. /**
  2. * Undo the last action, if possible
  3. */
  4. public void undo() {
  5. if (!undoDeltas.isEmpty()) {
  6. MapDataDelta delta = undoDeltas.pollLast();
  7. MapDataDelta inverse = data.apply(delta);
  8. redoDeltas.addLast(inverse);
  9. }
  10. updateMenuAndToolbar();
  11. changedSinceLastSave = true;
  12. }

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

  1. private SimpleMergeRSIDTest(String... arg) {
  2. super(SimpleMergeRSIDTest.class);
  3. LinkedList<String> allStrings = new LinkedList<String>(Arrays.asList(arg));
  4. expected = allStrings.pollLast();
  5. inputs = allStrings;
  6. }

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

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

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

  1. @Override
  2. public Object pollLast() {
  3. if (!_directAccess && isDelayLoad()) {
  4. load();
  5. }
  6. return super.pollLast();
  7. }

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

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

相关文章